User Login processing code how to write Ah.
Session_Start ();
?>
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
/>
<title></title>
Header ("Content-type:text/html;charset=utf-8");
Connecting to a database
mysql_connect ("localhost", "root", "");
mysql_select_db ("db12");
/** The purpose of the file is to receive user input information, to query, to determine if there is, if stored
In the jump to the Success page, if the error, give an error prompt. */
Accept user parameters (user name, password)
$user =$_post[' username '];
$pass =$_post[' password '];
Query according to user name, take out password
$sql = "Select password from tb_user where Username= '". $user. "'";
Execute Query
$rs =mysql_query ($sql);
if ($rs! = "") {
$selpass =mysql_result ($rs, 0);
}
if ($selpass! = ") {
Determine if the password taken is consistent with user input
if ($pass = = $selpass) {
$_session[' username ']= $user;
?>
}else{
Prompt for password error
?>
}
}else{
If the information is not queried according to the user name, the user name does not exist
?>
}
?>
The above is written to handle the user login code,
Why this is shown on the login screen regardless of whether the correct or incorrect information is entered:
------Solution--------------------
Print_r () your username and password don't know what's going on!
------Solution--------------------
Why not? Your second form has no username and password controls at all, and of course it's an error.
Print_r ($_post); It's clear.