Guest jay4five Posted April 29, 2006 Share Posted April 29, 2006 Hey all, a newbie here...I`m struggling big time with this query....Currently i have a login link/text on my website which takes the user to a login page. Now what i would like to do is, when the user has logged in, the log in link/text would change to logout (which would then log them out). I don`t want the pages to be restricted, i just want to show that they have logged into the site.How do i go about this ?Pleassssse help.RegardsJay Link to comment Share on other sites More sharing options...
Nakor Posted May 1, 2006 Share Posted May 1, 2006 You could set a cookie when they log in , destroy it when they log out, and dynamically display text based upon existance of that cookie. <? if (!$_COOKIE[login] == "loggedin") { echo "Log in"; // the page you would log in to would be where you set the cookie}if ($_COOKIE[login] == "loggedin") { echo "Log out"; setcookie("login", time()-3600) // this sets the cookie to have expired an hour ago, deleting it and displaying the log in text when they visit the page again}?> Link to comment Share on other sites More sharing options...
justsomeguy Posted May 1, 2006 Share Posted May 1, 2006 This shouldn't be posted in SQL btw, you should be asking in PHP or ASP, or whatever scripting language you are using. Link to comment Share on other sites More sharing options...
aspnetguy Posted May 1, 2006 Share Posted May 1, 2006 which language are you using?? Once you let us know I'll move this post to the right forum...you will get better results that way. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now