html - PHP - Redirecting to previous page after logging in AND INCLUDING GET DATA -


okay first off, sorry if duplicate. i've searched around 20 minutes on stack overflow , internet, , can't seem find solution problem.

what i'm trying do:

i have login form on every page, hidden input containing current page user on - when login, redirects page on.

e.g. user on news.php , not logged in. login, takes them login.php verify data, redirects news.php

this works great!

the problem: if there data or anchor tags @ end of url, can't seem redirect that.

e.g. user on news.php?id=4#comments , not logged in. login, etc etc, redirects news.php , ignores trailing data.

anyone have here?

my code:

<input type="hidden" value="<?php echo $_server['http_referer']; ?>" name="location"  />  $previouspage = $_post['location']; header("refresh: 1; url=".$previouspage); 

obviously think issue $_server['http_referer'] part, i'm not sure replace make include trailing data.

all appreciated!

just use

print_r($_server);

and select 1 fits needs most!

hint: combine http_host , request_uri.

the hash portion never send server: can read hash portion of url on server-side application (php, ruby, python, etc.)?


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -