views:

11

answers:

1

Hello, On my social network. There are "home" links that take you to the appropriate index if you are signed in or out. There is a "index.php", that if you are browsing the site signed out, it takes you there, and if signed in, and hit "home" it takes you to "index_signedIn.php"

This is working fine for me. The problem is, when I close the window, and open it back up, its on the "index.php" even if you are signed in,and can allows you to continue in a signed in manner. Someone helped me set up the init.php, and I can not see anything in there that would relate to this.

If you have a idea what the problem may be, and want to help, please let me know what code you may need, if any.

thanks in advance

in my masthead I have these links ( and on the footer as well )

<div id="social_tag">
    <?php if($auth) { ?>
        <a href="index_signedIn.php"><img src="styles/images/social_tag.png" border="0" /></a>
    <?php }else{ ?>
        <a href="index.php"><img src="styles/images/social_tag.png" border="0" /></a>
    <?php } ?>
</div>

if your session times out this happens:

function enforce_auth() {
    global $auth;
    if(!$auth) {
        header("Location: signin.php?return=" . $_SERVER['REQUEST_URI']);
        exit;
    }
}

and this is on the pages that we don't want people to be able to go to if they are singed out, and right now it dumps you to the index (as it should,)

enforce_auth();

just need it to take you to index_signedIn.php when the window closes and reopens and you are still signed in

+1  A: 

Add logic in the top of index.php:

if(loggedin())
{
    header('Location:index_signedin.php');
    exit();
}

Replace loggedin() with whatever logic you have to determine if the user is logged in.

methodin
Thanks! Totally worked. Can't believe I did not think of that. A little new at this stuff :)
LightningWrist
We've all been there ;)
methodin