[英]mySQLi Query not giving correct information
我做了這個腳本:
$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'");
}
並且,它起作用。 直到禁止您重定向它為止。 即使您被禁止,它也會跳過它。
我看了一遍,用谷歌搜索,甚至問我的老師,沒有人知道有什么問題。
湯姆,請看看。
嘗試更改此行:
$checkbanned = mysqli_num_rows($checkactive_query);
至
$checkbanned = mysqli_num_rows($checkbanned_query );
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.