Retaining URL Variable
I can't find a way to keep a URL variable through the Login process. It works fine once the User is Logged In, but the variable gets lost if the User needs to go through the Login and Profile pages.
Any help appreciated.
I can't find a way to keep a URL variable through the Login process. It works fine once the User is Logged In, but the variable gets lost if the User needs to go through the Login and Profile pages.
Any help appreciated.
The reason for this is that the successRedirect is hardcoded to users_Profile.php and the faileRedirect is hardcoded to loop back to the login page with a failed url variable. You would want to append any of the url variables to that dynamically if you wanted to retain them. Make sure you don't append the failed=1 to the successRedirect if there is one.
On your users_Login.php page, you would want to make these modifications on these lines:
"successRedirect" => "users_Profile.php",
"failRedirect" => "users_LogIn.php?failed=1",
The successRedirect is in two places.
Can I add the code as follows:
"successRedirect" => "users_Profile.php?php echo $row_rsDispatches['DSerial']; ?"
Regards.
Sorry. I forgot to add the second part.
Or, should I use "?php echo $_GET['DSerial']; ?"
Regards again.
The way you're doing it it will just be used as text, so the url will be "users_Profile.php?php echo $row_rsDispatches['DSerial']; ?". You would want to append the variables (not using echo), just string concatenation.
I don't understand the answer; could you correct my example for me, using the 'DSerial' variable?
Regards.
"successRedirect" => "users_Profile.php?" . $row_rsDispatches['DSerial'];
you can't start a php block within a string the way you did it. In this case, the DSerial should have a string value in it, so you can just append it to the string.
Although that change seems to have worked, the variable still doesn't pass through users_Profile.php to the final protected page. Is there a similar setting in users_Profile.php that needs to be changed?
Regards.
sorry, I meant to write it out like this:
"successRedirect" => "users_Profile.php?" . "DSerial=" . $row_rsDispatches['DSerial'];
A colleague pointed out that if you just change the action of the form to this:
action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>"
That should get you on your way.
The current form action is slightly different:
<form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" name="WAATKLogInForm" id="WAATKLogInForm">
The brackets don't balance in your sample. Could you just revise this code to what it should be? Much appreciated.
Regards.
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.