目录
一、登录功能
<?php
session_start();
if(isset($_POST['username']) && isset($_POST['password'])){
$username=$_POST['username'];
$password=$_POST['password'];
$sql="SELECT * FROM user_form WHERE username='{$username}' AND password='{$password}'";
$res=mysqli_query($link,$sql);
$row = mysqli_fetch_assoc($res);
if(!$row){
$url = 'login.php';
echo '<script>alert("用户名或密码输入错误!");location.href="'.$url.'"</script>';
}else{
$_SESSION['userid']=$row['userid'];