mariovaldez.net http://www.mariovaldez.net/webapps/forums/ |
|
Should be simple edit http://www.mariovaldez.net/webapps/forums/viewtopic.php?f=11&t=231 |
Page 1 of 1 |
Author: | Vigilante [ 18 Jun 2005, 16:11 ] |
Post subject: | Should be simple edit |
Hi, I realize there are a lot of people with issues to work on but hopefully mine is real simple, thanks for your help. I have it installed and it all works great. Very easy and simple script by the way, thank you! On my "secure" page, which is just one simple php page to edit a sqlite db. When they click the logout button, I can have it redirect to index, or my admin page. Which is fine. But when they log out, it goes to the username/password page, rather then the main page. Like if logout goes to index.php?logout=1 then this url is in the address bar and it sits at the user/pass box. But I don't want that, I want it to log out, but go to just index.php and view the actual page. Users do NOT require authentication to view index.php. So I set the variable $slogin_noauthpage = 1;. However, instead of showing index.php it shows login box. If it erase "?logout=1" from the address bar, the page works fine. How can I edit the script so when they logout it just goes to index.php and not login box? Thanks a bunch |
Author: | victoria [ 20 Jun 2005, 08:56 ] |
Post subject: | Logout redirecting |
I also was wanting to redirect my logout to my home page url and not sure how to do this. |
Author: | Vigilante [ 20 Jun 2005, 12:23 ] |
Post subject: | Quick Fix |
I created a little hack to make it do what I want. This may work for you too until a more suitable fix presents itself. Create a new file in the same directory as your logout page, or wherever I guess, called "logout.php". Then put this code: Code: <?php session_start(); $slogin_noauthpage = 1; include_once ("slogin_lib.inc.php"); ?> <html> <head> <META NAME="Robots" CONTENT="NOINDEX"> <meta http-equiv="refresh" content="3; URL=index.php"> </head> <body> <script language="JavaScript"><!-- setTimeout('Redirect()',4000); function Redirect() { location.href = 'index.php'; } // --></script> You are logged out<br /><br /> Page will refresh automatically </body> </html> Save this file. Then for your logout links, have it go to this page, mine looks like this: Code: <a href="logout.php?logout=1">logout...</a>
You can change the paths if needed of course. Also inside logout.php change the path for the include as well. So the way it works is when you click logout, it goes to logout.php to do the logout code, then automatically redirects to whatever page you want. Within the logout page it has two modes of refresh, HTML meta tag and also javascript. So if the browser doesn't support the meta refresh then maybe it will support the javascript version, or vice versa. The amount of time it takes to refresh can also be changed from within logout.php. That's the "3" and the "3000" I think. In milliseconds. Hope that works for now! |
Page 1 of 1 | All times are UTC - 7 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |