Jump to content

login redirect refferer


UnknownPlayer

Recommended Posts

Hi, i need help with refferer redirect after login.

Example:

- i am on user profile page (not required to be logged in)

- when i click send PM (it goes to that address and that page check if user is logged in, if not it  redirect user to login page)

now in input hidden value(login page), where i save referrer url, there is not address of send PM link, but  link from users profile page, i dont know why ?

And after i login it redirect me to profile page not to send PM page.

 

 

This is that send PM page:

<?php include("includes/connection.php"); ?>
<?php include("includes/functions.php"); ?>
<?php check_login(); ?>
<?php include("includes/header.php"); ?>
.
.
.
.
.

 

 

Login input hidden field:

<input type="hidden" name="ref" value="<?php echo (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ''; ?>" />

Why it doesnt redirect me to send PM page after login ?

Link to comment
https://forums.phpfreaks.com/topic/252593-login-redirect-refferer/
Share on other sites

After login check statement in db, this is code for redirect:

						if (!empty($_POST['ref'])) {
						if (preg_match(SITE_URL, $_POST['ref'])) {
							redirect_to($_POST['ref']); // this is function with header("Location: {$value}") and exit;
						} else {
							redirect_to(SITE_URL."moj-kabinet");
						}
					}

 

But problem is that that input hidden field is with address that show user profile page, not that from send PM page ?

Do i need to put include header before check_login(); function ?

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.