PHP Login Program

Source: Internet
Author: User
Tags define session md5 encryption

"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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.