0
我做了這個腳本:mysqli的查詢沒有給予正確的信息
$username = $_POST["username"];
$password = sha1($_POST["password"]);
$checkuser_query = mysqli_query($con,"SELECT * FROM users WHERE username='$username' AND password='$password'");
$checkuser = mysqli_num_rows($checkuser_query);
$checkactive_query = mysqli_query($con,"SELECT * FROM users WHERE username='$username' AND verified='0'");
$checkactive = mysqli_num_rows($checkactive_query);
$checkbanned_query = mysqli_query($con,"SELECT * FROM users WHERE username='$username' AND closed='1'");
$checkbanned = mysqli_num_rows($checkactive_query);
if(empty($_POST["username"]) || empty($_POST["password"])) {
header("Location: http://empirebattles.co.uk/Login?alert=nofilled");
}
elseif($checkuser<= 0) {
header("location: http://empirebattles.co.uk/Login?alert=loginfailed");
}
elseif($checkactive==1) {
header("location: http://empirebattles.co.uk/Login?alert=unverified");
}
elseif($checkbanned==1) {
header("location: http://empirebattles.co.uk/Login?alert=banned");
}
else {
header("Location: http://empirebattles.co.uk/Home");
setcookie("EmpireBattles",$username,time() + (10 * 365 * 24 * 60 * 60),"/");
mysqli_query($con,"UPDATE users SET online = '1' WHERE username = '$username'");
}
而且,它的工作原理。直到它被重定向的地步,如果你被禁止。即使你被禁止,它也會跳過它。
我看了一下,用它搜索了一下,甚至問我的老師,誰也看不出有什麼問題。
請看看, 湯姆。
定義checkactive_query? – Randy
是的。看我最近的編輯。 –