offdarip Posted October 1, 2010 Share Posted October 1, 2010 I have a header as a include at the top of each page. When a member is NOT logged in, it displays a header with login option and some non member links, when member IS logged in it displays a header with member options. That part of the script works fine, however when i log in on that page and the member header is displayed.. If i visit another page or refresh that page it loses the session like its been logged out and just displays the standard header. Any help would be greatly appreciated. index.php <?php session_start(); $path = (isset($_SESSION['LOGINID']) ) ? 'memberheader.php' : 'header_tmp.php'; include( $path ); ?> this is the auth script included in the member header memberheader.php <?php require_once('scripts/auth.php'); ?> auth.php (the actual auth script) <?php //Start session session_start();{ } if(!isset($_SESSION['LOGINID'])) { header("location: access-denied.php"); exit(); } ?> I didn't include login page because the login script works fine on each page except the ones with the multi header include. The pages that only include the memberheader works fine Quote Link to comment Share on other sites More sharing options...
ialsoagree Posted October 1, 2010 Share Posted October 1, 2010 It isn't clear what's going on. A user goes to the index page logged out. They then login using a script you haven't provided. They then get redirected... where? And are they still logged in at this point? Is "memberheader.php" a file that only has the script require_once('scripts/auth.php');? If so, why not just have require_once('scripts/auth.php'); in each of the pages that need it, and ditch memberheader.php entirely? Quote Link to comment Share on other sites More sharing options...
offdarip Posted October 11, 2010 Author Share Posted October 11, 2010 the login portion of it works fine which is why i did not post that portion of the script. I need the member header because it provide tools and options only available for members and the guest header will allow user to log in. It redirects to the same page. Initially it shows it is logged in, but if i got to another page or refresh that page it goes back to the guest header and is logged out Quote Link to comment Share on other sites More sharing options...
offdarip Posted October 11, 2010 Author Share Posted October 11, 2010 i figured it out.. I knew it was something super simple and it was.. Thanks for the willingness to help tho Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.