It works when i am logged in, but where i log-out, i cant access the log-in form. I am getting this:
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.
Here is the code:
[syntax=php]if(is_logged_in) {
header("Location: edit_profile.php");
}
else {
header("Location: login.php");
}[/syntax]
What have i done wrong??
i have also made changes in user.inc.php file:
[syntax=php]//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;
}
[/syntax]