开发者

opening a new window counteracts my "enforce_auth"

开发者 https://www.devze.com 2023-01-18 12:15 出处:网络
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\", th开发者_如何学编程at if you are browsing the site signed o

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", th开发者_如何学编程at 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消