Late-night code tried countless ways to finally see the results
login.php content is as follows
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >< HTML xmlns= "http://www.w3.org/1999/xhtml" >
login_1.php content is as follows
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/><?php error_reporting (0), if (!isset ($_post[' submit ')) { exit (' illegal access! '); } $name =$_ post[' LoginName '; $password =$_post[' loginpwd '];include (' connect.php '); if ($name && $password) { echo "come in"; $sql = "SELECT * from admin where adname= ' $name ' and adpwd= ' $password '"; $res =mysql_query ($sql); echo "$res"; echo "$name"; $test =mysql_fetch_array ($res); if ($test && strcmp ($name, ' admin ') ==0) { header ("location:index.php"); echo "finally"; Exit; } else{ echo "fail to login"; Exit; } Mysql_free_result ($res); Mysql_close ($conn); }? >
connect.php content is as follows
<?php $conn =mysql_connect (' localhost ', ' root ', ') or Die ("Connection Failed". Mysql_error ()); mysql_select_db (' door ', $conn) or Die ("Select Database Failed". Mysql_error ()); mysql_query ("Set names gb2312");? >
The database is designed as follows
PHP Login Verification and code implementation with database design Pro-Test effective