Home > Backend Development > PHP Tutorial > How to implement user registration and login in php mysql_PHP tutorial

How to implement user registration and login in php mysql_PHP tutorial

WBOY
Release: 2016-07-13 09:59:37
Original
1094 people have browsed it

php mysql method to implement user registration and login

This article mainly introduces the method of php mysql to implement user registration and login, which can realize simple user registration and login function, and has certain For reference value, friends in need can refer to it

The example in this article describes how php mysql implements user registration and login. Share it with everyone for your reference. The specific analysis is as follows:

This is a user registration and login code implemented using php and mysql database. The function is also a relatively simple and practical user registration program. It also adds a verification code program when the user logs in. This is much safer. 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 be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/975895.htmlTechArticlephp mysql method to implement user registration and login. This article mainly introduces the method of php mysql to implement user registration and login. Implement the function of simple user registration and login, which has certain reference...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template