本文共 605 字,大约阅读时间需要 2 分钟。
-
-
- <?php
- function check_input($value)
- {
-
- if (get_magic_quotes_gpc())
- {
- $value = stripslashes($value);
- }
-
- if (!is_numeric($value))
- {
- $value = "'" . mysql_real_escape_string($value) . "'";
- }
- return $value;
- }
-
- $con = mysql_connect("localhost", "hello", "321");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
-
-
- $user = check_input($_POST['user']);
- $pwd = check_input($_POST['pwd']);
- $sql = "SELECT * FROM users WHERE
- user=$user AND password=$pwd";
-
- mysql_query($sql);
-
- mysql_close($con);
- ?>
转载于:https://www.cnblogs.com/flyoo/archive/2012/12/20/2825896.html