background image

$link = mysql_connect("localhost", "root", "root") 

or die("无法建立 MySQL 数据库连接:" . mysql_error()); 

mysql_select_db("cms") or die("无法选择 MySQL 数据库"); 

if (!get_magic_quotes_gpc()) 

$query = "select * from member where username=’" . addslashes($_POST["username"]) . 

"’ and password=’" . addslashes($_POST["password"]) . "’"; 

else 

$query = "select * from member where username=’" . $_POST["username"] . 

"’ and password=’" . $_POST["password"] . "’"; 

$result = mysql_query($query) 

or die("执行 MySQL 查询语句失败:" . mysql_error());