OKay, I'm trying to do a log in where if the user is logged in it performs one function, if the user is not, or the password is wrong, it performs another function. So here is my code,
function checklogin() {
global $userid, $userpassword, $return;
echo $userid;
echo $userpassword;
if (empty($userid)) {$return='no';}
$check=mysql_query("select userid, password from users where userid = '$userid'");
$checkid=mysql_result($check,0,'userid');
$checkpass=mysql_result($check,0,'password');
if (($userpassword = "$checkpass") AND ($userid = "$checkid")) $return="yes";
if (($userpassword != "$checkpass") OR ($userid !="$checkid")){
echo "Incorrect Login";
$return="no"; }
return $return;}
checklogin();
switch($return) {
case
'no':
not_loggedin();
break;
case
"yes":
logged_in();
break;
}
problem is, the code returns yes even if the password supplied is incorrect, i've echoed them side by side, and yes, the userpassword and checkpass are different, but it returns the yes for return. I cannot figure out why