if ($_post[submit]) {
$username = Str_replace ("", "", $_post[username]);
$sql = "SELECT * from User_list where ' username ' = ' $username '";
$query =mysql Tutorial _query ($sql);
$US =is_array ($row =mysql_fetch_array ($query));
$ps tutorial = $US? MD5 ($_post[password]. ALL_PS) = = $row [password]: FALSE;
$PW = $ps $_session["code"]==$_POST[CODE]:FALSE;
if ($ps) {
$_session[uid]= $row [UID];
$_SESSION[USER_SHELL]=MD5 ($row [username]. $row [Password]. ALL_PS);
$_session[times]=mktime ();
if ($PW) {
echo "landed success";
}
else{
echo "Validation code Error";
Session_destroy ();
}
}else{
echo "Password or username error";
Session_destroy ();
}
}
?>
<form action= "" method= "POST" >
User name: <input type= "text" name= "username" style= "height:23px"/><br>
Password: <input type= "password" name= "password" style= "height:23px"/><br>
Verification code: <input type= "code" name= "code" size= "style=" "height:23px"/>
<br><br>
<input type= "Submit" name= "Submit" value= "Landing"/>
</form>
Database Tutorial Structure
--
--The structure of the table ' User_list '
--
CREATE TABLE ' User_list ' (
' UID ' int (one) not NULL auto_increment,
' m_id ' varchar (5) Not NULL,
' username ' varchar not NULL,
' Password ' varchar not NULL,
PRIMARY KEY (' uid ')
) Engine=myisam DEFAULT charset=gb2312 auto_increment=11;
--
--Export the data in the table ' User_list '
--
INSERT into ' user_list ' (' uid ', ' m_id ', ' username ', ' password ') VALUES
(9, ' 1 ', ' admin ', ' 75cf565ad38d0f837c43363e 402b1a00 '),
(Ten, ' 2 ', ' admin2 ', ' 75cf565ad38d0f837c43363e402b1a00 ');