Php + mysql Implementation of user registration and login Methods
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:
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<Html xmlns = "http://www.jb51.net/1999/xhtml">
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = gb2312"/>
<Title> Add users in the background </title>
</Head>
<Body>
<? Php
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 "</br> ";
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.