close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Redirect After Logout

Thread began 2/21/2013 5:07 pm by wellsjm435768 | Last modified 8/14/2016 11:27 am by Ray Borduin | 3264 views | 12 replies |

wellsjm435768

Redirect After Logout

How can I get the logout.php to redirect to another page?

Scenario:
Person is logged in...they log out...they are directed to a page other than logout.php.

Thanks in advance...

Sign in to reply to this post

Jason ByrnesWebAssist

on the logout page, add a restrict access behavior: webassist -> Security Assist -> Secure Page. Set it to grant access if "Logged into <your users table>" (where <your users table> is the name of your users table) and redirect to another page if access is denied.

makes sure the access page behavior code is after the clear session code on the logout page.

Sign in to reply to this post

wellsjm435768

Jason

I got to the Secure Page pop-up window. In the "Grant Access if:" I see this ***No Rules Defined***. Do I need to create a rule, and if so, how? Is there a video tutorial on this?

Thanks

Jon

Sign in to reply to this post

wellsjm435768

I'm not sure what to put in the "Value", "Criteria", and "Compare to" fields.

Sign in to reply to this post

Jason ByrnesWebAssist

the rules should have been created when you ran the security assist wizard to create the login , registration and logout pages.

can you send a copy of the logout, and login page and a copy of the webassist/security_assist/helpergrouprules.php files please.

the logout page is saved to the same location as the login page right?

Sign in to reply to this post

wellsjm435768

Hi Jason

I just wiped all my files and started over and now things are working fine. Thanks

Jon

Sign in to reply to this post

AndyG

Jason, I'm having problems with this. If I've followed your instructions correctly the code below should both logout the user and redirect.
However what I find is that I'm stuck on the logout.php and no redirect takes place!
Can you assist?
regards
AndyG.

---------------------

<?php require_once( "../webassist/security_assist/helper_php.php" ); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Logged Out</title>
</head>

<body>
<?php
@session_start();
if ("" == ""){
// WA_ClearSession
$clearAll = TRUE;
$clearThese = explode(",","");
if($clearAll){
foreach ($_SESSION as $key => $value){
unset($_SESSION[$key]);
}
}
else{
foreach($clearThese as $value){
unset($_SESSION[$value]);
}
}
}
?>
<?php
if (WA_Auth_RulePasses("Logged in to users")){
WA_Auth_RestrictAccess("../index.php");
}
?>
<div id="LogOutContainer" class="WAATK">
<h1>Log Out</h1>
You have successfully logged out. </div>
<p><a href="login.php">Login.</a></p>
</body>
</html>

Sign in to reply to this post

Jason ByrnesWebAssist

The problem is that the php code to clear the sessions and to redirect if not logged in comes inside the HTML <body> tag, it should be before the doctype tag for the redirect to work.

php:
<?php require_once( "../webassist/security_assist/helper_php.php" ); ?>

<?php 
@session_start();
if (
"" == ""){
// WA_ClearSession
$clearAll TRUE;
$clearThese explode(",","");
if(
$clearAll){
foreach (
$_SESSION as $key => $value){
unset(
$_SESSION[$key]);
}
}
else{
foreach(
$clearThese as $value){
unset(
$_SESSION[$value]);
}
}
}
?>
<?php
if (WA_Auth_RulePasses("Logged in to users")){
WA_Auth_RestrictAccess("../index.php");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Logged Out</title>
</head>

<body>

<div id="LogOutContainer" class="WAATK">
<h1>Log Out</h1>
You have successfully logged out. </div>
<p><a href="login.php">Login.</a></p>
</body>
</html>
Sign in to reply to this post

AndyG

ok thanks Jason, that makes sense.
However, the logout works, but still no redirect!
Stays on the logout.php page!
Any ideas?
Andy.

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...