0

I have a javascript login box on my site (www.cigardig.com) that a user can click on and login on any page. The way I would like it to work is that once a user hits submit, they are redirected back to the page they logged in on. So, for example, if I login in Page 1, I want to be redirected back to Page 1 once the login is successful.

I have it implemented now; however, I've read that it's not a reliable method since some browsers and/or firewall software blocks the sending of this variable. Honestly though, I thought that since this is handled on the server not the browser that it shouldn't be blocked?

In any case, is there another way to do this that is compatible across every browser?

5
Contributors
5
Replies
17
Views
6 Years
Discussion Span
Last Post by bakhtn
0

Did you have any difficulties with your method? If it's not broken, don't fix it.
What is "this variable"? What are you doing now in your script? Are you working with sessions or with redirects or with cookies?

0

The wonders of scripting, perhaps have the link be smarter, in something like

<a href='login.php'> //be something like
<a href='login.php?refer=<?php echo $_SERVER['PHP_SELF']; ?>'>

and have the login page return to the supplied parameter

0

Did you have any difficulties with your method? If it's not broken, don't fix it.
What is "this variable"? What are you doing now in your script? Are you working with sessions or with redirects or with cookies?

Smant,

The code is working beautifully when I test it in Safari, Chrome, Firefox, and iOS (I'm going to test in IE tomorrow). I had just read that that using this code is sometimes blocked by certain firewalls so I just trying to make the site as universally accessible as possible.

The "variable" I was reffering to was $_SERVER and I'm using sessions currently but will be implementing a cookie alternative for a persistent session.

0

I use below logic.
In login form place a new hidden field which will have user's current location with query parameter.

<input type='hidden' name='page' value='<?=basename($_SERVER["PHP_SELF"]).'?'.$_SERVER["QUERY_STRING"]?>' />

In php side coding use below redirection.

header('location:'$_POST['page']);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.