欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

基于 php 的摄影门户网站 - 代码

最编程 2024-09-30 07:30:11
...
<?php  
session_start();  
  
$username = $_POST['username'];  
$password = md5($_POST['password']); 
  
$sql = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";  
$result = mysqli_query($conn, $sql);  
  
if (mysqli_num_rows($result) == 1) {  
    // 登录成功  
    $_SESSION['loggedin'] = true;  
    $_SESSION['username'] = $username;  
    header("Location: welcome.php");  
    exit;  
} else {  
    // 登录失败  
    echo "用户名或密码错误";  
}  
  
mysqli_close($conn);  
?>

推荐阅读