mariovaldez.net

MV.net forums
It is currently 14 Jul 2016, 00:33

All times are UTC - 7 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Should be simple edit
PostPosted: 18 Jun 2005, 16:11 

Joined: 18 Jun 2005, 16:03
Posts: 2
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Logout redirecting
PostPosted: 20 Jun 2005, 08:56 
I also was wanting to redirect my logout to my home page url and not sure how to do this.


Report this post
Top
  
Reply with quote  
 Post subject: Quick Fix
PostPosted: 20 Jun 2005, 12:23 

Joined: 18 Jun 2005, 16:03
Posts: 2
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!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group