Jump to content

reference link with login


timmah1

Recommended Posts

On certain pages, if you're not logged in, my page forces you to the login page with a ref tag, so when you login, it automatically takes to the page you were on.

 

For some reason, this is not working, it's always going to the default.

 

Here is what's on the top of the page

$id = $_GET['id'];

if(isset($_SESSION['SESS_LOGGEDIN']) == FALSE){
	header("Location: " . $config_basedir . "login.php?error=1&ref=review&id=$id");
}

 

Then my login code

if($loginrow['active'] == 1){

					$_SESSION['SESS_LOGGEDIN'] = 1;
					$_SESSION['SESS_USER'] = $loginrow['id'];
					$_SESSION['SESS_EMAIL'] = $loginrow['email'];
					$_SESSION['SESS_LEVEL'] = $loginrow['level'];

							switch($_GET['ref']) {

								case "review":
									header("Location: " . $config_basedir . "write.php?id=$_GET[id]");
								break;

								default:
									header("Location: " . $config_basedir . "main.php");
								break;

							}
				}

 

Can anybody see why it always go to the dafault?

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/143723-reference-link-with-login/
Share on other sites

if the top code was a.php, and the 2nd b.php, if i visited a.php it would send me to b.php and would then be sent to review.

 

there must be  something else, try var dump the $_GET array:

 

echo("<pre>"); var_dump($_GET); echo("</pre>");// DEBUG LINE TO SEE WHAT IS INSIDE _GET
switch($_GET['ref']) {

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.