<?php session_start(); ?> <meta charset="UTF-8"> <title>login</title> <?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(); ?>
以上就介绍了登陆界面模拟02-login页面,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。