Jump to content

login wouldnt change to logout


divinedesigns1
 Share

Recommended Posts

first timer, im trying to make this code switch from login to logout when someone log onto the websitethis is how it is set up

<?phpif(isset($_SESSION['uid'])){?>    <a href="logout.php">Log Out</a>    <?php}else{?>    <a href="login.php">Log In</a>    <?php}?>

i have at the very top session_start(); inside of an opening and closing php tags then the html texts, and inside of a table thats where i have the above code so when i log in it redirect me to the index page and then it changes to logout, but it doesnt it keeps login -_- not what i want to happen does anyone see anything wrong here?

Link to comment
Share on other sites

It sounds like $_SESSION['uid'] isn't set. Remember, also, that session_start() needs to be on every single page.
yeah i set it on the login page also ill check it out on the login page see whats going on there, thanks foxy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...