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
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 ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.