PHP Login Verification and code implementation with database design Pro-Test effective

Source: Internet
Author: User
Tags wrapper

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

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.