Home >Backend Development >PHP Tutorial >Login interface simulation 02-login page

Login interface simulation 02-login page

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 09:12:501144browse
<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>login</title>
</head>
<body>
	<?php
		 $s_username = $_POST["username"];
		 $s_password = $_POST["password"];

		 

		$conn = new mysqli("localhost:3306","dbuser","dbpassword","dbname");
		if($conn->connect_error)
		{
			die("Connection failed:".$conn->connect_error);
		}
	
		if($stmt=$conn->prepare("SELECT username password FROM customer WHERE username=? AND password=?"))
		{
			$stmt->bind_param("ss",$s_username,$s_password);
			$stmt->execute();
			$stmt->bind_result($U);
			$HasData=false;
			while($stmt->fetch())
			{
				$HasData=true;
				echo "你又来了,"."$s_username";
				$_SESSION['token']=$s_username;
			}
			if($HasData==false)
			{
				echo "账号名或密码不存在。";
			}
		}
		$conn->close();
	?>
</body>
</html>

The above introduces the login interface simulation 02-login page, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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