Login interface simulation 02-login page

WBOY
Release: 2016-07-29 09:12:50
Original
1086 people have browsed it
<?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>
Copy after login

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.

Related labels:
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