Posted by member 45025 on 2004-06-17 13:35:06 link

actually, it could be done quite shortly; Maybe not the most technically correct method but it should work.

Store the referring url in a hidden field in the login form.
Check if the variable is set just after the login.
If it is, firstly you would need to check that the referring url came from this site so that you don't throw people out who came in from a link then send a redirect header using the url in the hidden field.

Code might look something like this;
In the login page/template:
echo '";

The redirect bit would look something like:
if(isset($_REQUEST['_ref']) && !empty($_REQUEST['_ref']))
{
$urlParts = parse_url($_REQUEST['_ref']);
if(strcasecmp($urlParts['host'], "litestep.net") == 0)
header("Location: " . $_REQUEST['_ref']);
}

I haven't tested this code since I recently re-installed and don't have my dev server up but it should work.

*edit*
I think i should also add that it wont really work for forum posts and such; You would still have to go back because it is just a workaround solution but it is better than nothing.