If logged in...
Posted: Wed Jun 15, 2011 6:06 am
I made this code for users that are logged in to "Not see the log-in form" when if they are logged in.
It works when i am logged in, but where i log-out, i cant access the log-in form. I am getting this:
i have also made changes in user.inc.php file:
It works when i am logged in, but where i log-out, i cant access the log-in form. I am getting this:
Here is the code:The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept
cookies.
if(is_logged_in) { header("Location: edit_profile.php"); } else { header("Location: login.php"); }What have i done wrong??
i have also made changes in user.inc.php file:
//checks if given username and password conbination is valid. function valid_credentials($user, $pass){ $user = mysql_real_escape_string($user); $pass = mysql_real_escape_string($pass); //$total = mysql_query("SELECT COUNT('user_id') FROM `users` WHERE `user_name` = '{$user}' AND `user_password` = '{$pass}'"); $total = mysql_query("SELECT * FROM `users` WHERE `user_name` = '{$user}' AND `user_password` = '{$pass}'"); if($total) { if(mysql_num_rows($total) > 0) { $_SESSION['uid'] = mysql_result($total, 0, "user_id"); //Add session variables here if needed return true; } else { return false; } } else { return false; } //return (mysql_result($total, 0) == '1') ? true : false; }