Php + mysql implementation of user registration and login _ PHP Tutorial

Source: Internet
Author: User
Php + mysql implements user registration and login methods. Php + mysql implementation of user registration and login methods this article mainly introduces php + mysql implementation of user registration and login methods, can achieve simple user registration and login functions, some reference methods for implementing user registration and login using php + mysql

This article mainly introduces how to implement user registration and login in php + mysql. it can implement simple user registration and login functions and has some reference value. if you need it, you can refer

This example describes how to implement user registration and login in php + mysql. Share it with you for your reference. The specific analysis is as follows:

This is a user registration and login code implemented using php and mysql databases. it is also a simple and practical user registration program, and also adds the verification code program for user logon, the code is as follows:

The code is as follows:





Add users in the background




Require_once ("config. php ");
If (isset ($ _ post ["submit2"]) {
Mysql_select_db ('a0807000225 '); // This is a database table.
$ Author = $ _ session ["user_name"];
Define (all_ps, "jinquan ");
Echo $ username = $ _ post ["username"];
Echo $ password = md5 ($ password = $ _ post ["password"]. all_ps );
Echo"
";
If ($ username ){
If ($ password ){
$ Str = "insert into 'dx _ user_list '('uid', 'M _ id', 'username', 'password') values (ascii (null ), '1', '$ username',' $ password ');";
$ Rs = mysql_query ($ str, $ conn );
Mysql_close ($ conn );
}
If ($ rs ){
Echo "script" alert ('added successfully '); location. href = 'yonghuzc. php' script ";
} Else {
Echo "script" alert ('add failed'); location. href = ''yonghuzc. php' script ";
}
}
}
?>

I hope this article will help you with php programming.

This article mainly introduces how to implement user registration and login in php + mysql, which can implement simple user registration and login functions, with some reference...

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.