I recently moved a site that I had designed from a Windows box running PHP 5 and MySQL 5 to a linux box running the same. However, When I attempt to use the login (which works perfectly on the windows box), I get the following error lines printed out:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/tshclan/public_html/
recruiting
/validate.
php on line 36
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tshclan/public_html/
recruiting
/validate.
php on line 37
Warning: array_values() [function.array-values]: The argument should be an array in /home/tshclan/public_html/
recruiting
/validate.
php on line 38
Here is a copy of the source:
<?php
$SubUser = $_POST['User'];
$SubPass = $_POST['Pass'];
$db = mysql_connect("localhost",
"*****", "*****", true);
mysql_select_db("tshclan_r
ct");
$query = "SELECT * FROM Users WHERE Users.User = '" . $SubUser . "'";
$result = mysql_query($query);
if (!$result) {
print "Error with Query";
}
$num_rows = mysql_num_rows($result);
$row = mysql_fetch_array($result)
;
$values = array_values($row);
$dbUser = $values[0];
$dbPass = $values[2];
$dbDiv = $values[4];
$dbRank = $values[6];
if ($dbDiv == "BF2") {
$Div = "Battlefield%202";
}
if ($dbDiv == "COD2") {
$Div = "Call%20of%20Duty%202";
}
if ($dbDiv == "BF2142") {
$Div = "Battlefield%202142";
}
if ($dbDiv == "ALL") {
$Div = "NULL";
}
if ((($dbUser == $SubUser) && ($dbPass == $SubPass)) || (($SubUser == $dbUser) && (md5($SubPass) == $dbPass))) {
setcookie("User", $dbUser, time()+3600);
setcookie("Pass", $dbPass, time()+3600);
setcookie("Div", $dbDiv, time()+3600);
setcookie("Rank", $dbRank, time()+3600);
print "<h1>Validated!</h1>";
//$link = "
http://www.tsh-clan.com/recruiting/main.php?user=" . $dbUser;
if ($Div == "NULL") {
$link = "
http://www.tsh-clan.com/recruiting/main.php";
} else {
$link = "
http://www.tsh-clan.com/recruiting/main.php?Div=" . $Div;
}
print $link;
header("Location: " . $link);
} else {
print "<p>You could not be validated at this time. Please check the username and password and try again</p>\n";
}
//print $SubUser . "..." . $SubPass;
?>
Any ideas?
Start Free Trial