"From the network, reference learning"
Added MD5 encryption
<?PHPerror_reporting(0);$mysql _servername= "";//Host Address$mysql _username= "";//Database user name$mysql _password="";//Database Password$mysql _database="";//Databasemysql_connect($mysql _servername,$mysql _username,$mysql _password);mysql_select_db($mysql _database); $name=$_post[' Name '];$password=$_post[' Password '];$VerificationCode=$_post[' Check '];//MD5 Encryption$MD 5password=MD5($password);//Verify the verification codeif($VerificationCode!=$_session[' Verifycode ']){Echo"<script Language=javascript>alert (' Verification code Error! '); History.back ();</script> ";} //Verify user name and passwordif($name&&$password){$sql= "SELECT * FROM admin WHERE admin_name = '$name' and admin_pw= '$MD 5password‘";$res=mysql_query($sql);$rows=mysql_num_rows($res);if($rows){//Define sessionSession_Start();$_session[' Admin_name ']=$name;Header("Refresh:0;url=. /index.php ");//Jump page, note the pathExit;}Echo"<script language=javascript>alert (' username password error '); History.back ();</script>";}Else {Echo"<script language=javascript>alert (' username password cannot be null '); History.back ();</script>";}?>
PHP Login Program