UnknownPlayer Posted December 6, 2011 Share Posted December 6, 2011 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/252593-login-redirect-refferer/ Share on other sites More sharing options...
Pikachu2000 Posted December 6, 2011 Share Posted December 6, 2011 Where is the code that performs the redirect? Quote Link to comment https://forums.phpfreaks.com/topic/252593-login-redirect-refferer/#findComment-1294984 Share on other sites More sharing options...
UnknownPlayer Posted December 6, 2011 Author Share Posted December 6, 2011 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/252593-login-redirect-refferer/#findComment-1294987 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.