我正在尝试检查帐户状态是否已验证。这是通过 Mysql 表中的 ENUM 列完成的。我已经能够将状态更改为已验证的“是”,但似乎无法检查它是“是”还是“否”。我尝试了以下代码的不同方式,但无济于事。提前谢谢大家。
<?php
ob_start();
session_start();
include '/home/wc002/include/dbconnect.php';
if (isset($_POST)) {
$username = strip_tags(trim($_POST['myusername']));
$password = strip_tags(trim($_POST['mypassword']));
$username = mysqli_real_escape_string($conn, $username);
// Register $myusername, $mypassword
$_SESSION["myusername"] = $username;
$_SESSION["mypassword"] = $password;
//Check if account is Verified
//$query ="SELECT Verified FROM Member WHERE Verified = false;";
//$check = mysqli_query($conn, $query);
//if ($check == true){
// echo "Please Verfiy your account";
//}
//else{
//Check username matches
$query1="SELECT `Password`, `salt` FROM `Member` WHERE `Username`='$username'";
$result1 = mysqli_query($conn, $query1);
if(mysqli_num_rows($result1) == 0) // User not found. So, redirect to TwitchMain.php again.
{
die(header("location:TwitchMain.php?loginFailed=true&reason=blank"));
}
$userData = mysqli_fetch_array($result1, MYSQL_ASSOC);
$hash = hash('sha256', $userData['salt'] . hash('sha256', $password));
//Incorrect password. So, redirect to TwitcMain.php again.
if($hash != $userData['Password'])
{
die(header("location:TwitchMain.php?loginFailed=true&reason=password"));
} else {
// Redirect to home page after successful login.
header('Location: Twitch.php');
}
}
?>