anon Posted January 14, 2008 Share Posted January 14, 2008 Hi, I'm reading a tutorial over at - http://www.phpeasystep.com/workshopview.php?id=6 It says that to terminate the session I should create a file: <? session_start(); session_destroy(); ?> If a user wanted to logout, would I make the Logout Button link to this file or something? Quote Link to comment https://forums.phpfreaks.com/topic/86008-question-about-tutorial-i-am-reading/ Share on other sites More sharing options...
revraz Posted January 14, 2008 Share Posted January 14, 2008 Yes, and i would change the <? to <?php If you set cookies, you can also clear them as well. After it's done, redirect them to your main screen. Quote Link to comment https://forums.phpfreaks.com/topic/86008-question-about-tutorial-i-am-reading/#findComment-439234 Share on other sites More sharing options...
anon Posted January 14, 2008 Author Share Posted January 14, 2008 So the logout button would be - <form name="form1" method="post" action="logout.php"> <input type="submit" name="Submit" value="Logout"> Then I would put a redirect in the logout.php file? Quote Link to comment https://forums.phpfreaks.com/topic/86008-question-about-tutorial-i-am-reading/#findComment-439245 Share on other sites More sharing options...
revraz Posted January 14, 2008 Share Posted January 14, 2008 Yes. Not sure why you are choosing to use a FORM for it though, why not just a Link? If you want a button, use a image. But your choice, either will work fine. Quote Link to comment https://forums.phpfreaks.com/topic/86008-question-about-tutorial-i-am-reading/#findComment-439249 Share on other sites More sharing options...
nafetski Posted January 14, 2008 Share Posted January 14, 2008 <?php session_start(); session_destroy(); // Use a 301 redirect rather than a meta Header( "Location: http://www.new-url.com" ); exit; ?> Any link connecting to this php page will end the session and send them to the login page. You don't have to use a form =D Quote Link to comment https://forums.phpfreaks.com/topic/86008-question-about-tutorial-i-am-reading/#findComment-439257 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.