close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


site will not redirect to previous url after login

Thread began 2/03/2010 1:25 am by in a Pickle | Last modified 3/11/2010 12:57 am by brian.ray338324 | 2463 views | 4 replies |

in a Pickle

site will not redirect to previous url after login

on the "users_Login.php" page i have the following "SecurityAssist Authenticate User" settings:

if(($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)){
$WA_Auth_Parameter = array(
"connection" => $localhost,
"database" => $database_localhost,
"tableName" => "users",
"columns" => explode($WA_Auth_Separator,"UserEmail".$WA_Auth_Separator."UserPassword"),
"columnValues" => explode($WA_Auth_Separator,"".((isset($_POST["username"]))?$_POST["username"]:"") ."".$WA_Auth_Separator."".((isset($_POST["userpassword"]))?$_POST["userpassword"]:"") .""),
"columnTypes" => explode($WA_Auth_Separator,"text".$WA_Auth_Separator."text"),
"sessionColumns" => explode($WA_Auth_Separator,"UserID".$WA_Auth_Separator."UserEmailVerified".$WA_Auth_Separator."UserEmail".$WA_Auth_Separator."UserFirstName"),
"sessionNames" => explode($WA_Auth_Separator,"UserID".$WA_Auth_Separator."UserEmailVerified".$WA_Auth_Separator."UserEmail".$WA_Auth_Separator."UserFirstName"),
"successRedirect" => "users_Profile.php",
"failRedirect" => "users_LogIn.php?failed=1",
"gotoPreviousURL" => TRUE,
"keepQueryString" => TRUE


And the Form Tag is as follows:

<form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" name="WAATKLogInForm" id="WAATKLogInForm">

After clicking a "Login" link on my "Home" page (which is not a protected page) which directs clients to the "users_LogIn.php" form, and submit a validated login, I am not returned to the "Previous URL" or "Home" page as all the documentation says it should.

It then goes to the "profile" page, instead. Please tell me what settings I have incorrectly set.

Sign in to reply to this post

Jason ByrnesWebAssist

The Goto Previous URL setting relies on a Querystring variable.

When you visit a protected page, you will be redirected to the login page with the accesscheck querystring variable set to the page you where redirected from.

you can create a link to the login page that that has the accesscheck variable set so that you will be redirected:

<a href="login.php?accesscheck=<?php echo (urlencode($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):"")));?>">Log In</a>
Sign in to reply to this post


not working for me either

The last comment said to add a link to the login page. where is that link supposed to be inserted? on every page that is protected? Hopefully not, or somewhere on the login page?
I'm using the powerstore 2 users_Login.php page, which does seem to have the accesscheck enabled in the url when posting, it just doesn't seem to go back to the previous url.

Sign in to reply to this post

Jason ByrnesWebAssist

the link to the login page goes on any page that you want the user to be able to access the login page from.

for the accesscheck to function, the login forms action needs to also pass the querystring variabel.

On the login page, change the form tag:

<form  action="<?php echo ($_SERVER["PHP_SELF"]);?>" method="post" id="WAATKLogInForm">


<form  action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""?>" method="post" id="WAATKLogInForm">
Sign in to reply to this post


Thank you very much. It was an easy fix and works perfectly. Huge help to my users!

Sign in to reply to this post

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





Ease of use


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...