Forum Moderators: coopster
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /functions.php on line 34
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /functions.php on line 36
Here is my functions file:
<script language="JavaScript">
function openWindow (url,name,widgets)
{
popupWin = window.open (url,name,widgets);
popupWin.opener.top.name="opener";
popupWin.focus();
}
</script>
<?
function wrongpass(){
?>
<table border=0 cellpadding=5 cellspacing=5>
<tr>
<td>
<font class="verify2">
<b>You have supplied an incorrect User Name and/or Password.</b>
</font>
</td>
</tr>
</table>
<?
}
//checks password and username
function checkpass($handle,$pass){
require_once($home."mysqlinfo.php");
include("i_aeskey.php");
$query="SELECT AES_DECRYPT(password,'$AES_key') FROM users WHERE (handle='$handle')";
$result = mysql_query($query);
if(mysql_num_rows($result));
{
if($r = mysql_fetch_array($result))
{$dbpass=$r[0];}
if($pass==$dbpass)
{return 1;}
else{
$querysecond="SELECT password FROM users WHERE (handle='$handle')";
$resultsecond = mysql_query($querysecond);
if(mysql_num_rows($resultsecond))
{
while($r = mysql_fetch_array($resultsecond))
{$dbpass=$r[0];}
if ($pst!=1){pak(&$pass);}
if($pass==$dbpass)
{return 1;}
else
{return 0;}
}
}
}
return 0;
}
//function used in password checking
function pak(&$string){
$salt=substr($string,0,2);
$string=crypt($string,$salt);
}
function teX($string,$class=""){
echo"
<table border=0 cellpadding=5 cellspacing=5>
<tr>
<td>
<font class=\"$class\">
<b>$string</b>
</font>
</td>
</tr>
</table>";
return 1;
}
?>
Any thoughts? I was working fine on my development server. Then I transfer the script to a different server and now I get this error.
Thanks in advance,
Christian
I assume that is this query dying
$query="SELECT AES_DECRYPT(password,'$AES_key') FROM users WHERE (handle='$handle')";
password should be between single quotes and $handle seems to be empty.
Try echo'ing $handle and see why it isn't getting assigned and put single quotes around password.