Jump to content

redirect loop for member system


nade93

Recommended Posts

Hi All

 

I am using the following method to check if user is logged in to a member area. However, I ahve a password change section that then redirects back the the password change page within the logged in area. After password changes it automatically redirects back to the index page rather than password page and comes up with a redirect error (too many redirects)

 

How can i change the code to match the new change in password. I think its a sessions problem but not great with sessions!

if(isset($_COOKIE['ID_my_site']))
{
    $username = $_COOKIE['ID_my_site'];
    $pass = $_COOKIE['Key_my_site'];
    $check = mysql_query("SELECT * FROM member_users WHERE email = '$username'")or die(mysql_error());
    while($info = mysql_fetch_array( $check ))
    {
	$usernameid=$info['username'];
$userid = $info['id'];
$firstname = $info['fname'];
$lastname = $info['lname'];
        //if the cookie has the wrong password, they are taken to the login page
        if ($pass != $info['password'])
        { 
            header("Location: index.php");
        }
        //otherwise they are shown the admin area
        else
        {
            echo "<div class=\"memberloginactive\">Welcome $firstname | Your Profile | <a href=\"edit-profile.php?id=$userid\">Edit Profile</a> | <a href=\"logout.php\">Logout</a></div><div class=\"clear\"></div>";
        }
    }
}
else

{

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.