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...
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...
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.
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
I'm not sure what to put in the "Value", "Criteria", and "Compare to" fields.
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?
Hi Jason
I just wiped all my files and started over and now things are working fine. Thanks
Jon
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>
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 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>
ok thanks Jason, that makes sense.
However, the logout works, but still no redirect!
Stays on the logout.php page!
Any ideas?
Andy.
I'll need to troubleshoot directly, see the private message section.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
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.