page isnot redirecting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
qumar
Forum Commoner
Posts: 29
Joined: Wed Nov 01, 2006 8:20 am

page isnot redirecting

Post by qumar »

Everah | Please use the appropriate bbCode tags when posting code in the forums.
hi,
if member isnot login, asking to login the page. but after login, the page isnot redirecting to previous page.

i am using the

Code: Select all

<?php
 $_SERVER['HTTP_REFERER']
?>
but i amnot getting the previous page. give some idea.
local working, but online not working. please help to me.
thanks,
qumar.

Everah | Please use the appropriate bbCode tags when posting code in the forums.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: page isnot redirecting

Post by Zoxive »

qumar wrote:hi,
if member isnot login, asking to login the page. but after login, the page isnot redirecting to previous page.

i am using the

<?php
$_SERVER['HTTP_REFERER']
?>
but i amnot getting the previous page. give some idea.
local working, but online not working. please help to me.
thanks,
qumar.
Some browsers don't give the Server the Referring Page, and you can even turn it off in Firefox.

Your Best Bet is to use $_GET Variables, or $_SESSION to store the last url they were at.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

Whenever I want that to happen I always save the page + all get variables that are currently on every time they load a page into a session variable. That way, if they do something like login and you want to put them back to where they where at first, then you can just check the session and bam, your good to go.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Something like...

Code: Select all

$location = $_SERVER['PHP_SELF'];
$location .= !empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '';
$location = urlencode($location);

header('Location: http://www.example.com/login.php?next=' . $location);
exit;
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
qumar
Forum Commoner
Posts: 29
Joined: Wed Nov 01, 2006 8:20 am

for search date not redirecting

Post by qumar »

Everah | Please use the appropriate bbCode tags when posting code in the forums.

hi,
i am using the following code to redirect to the previous page.

Code: Select all

<?php
$link=$_SERVER['PHP_SELF'];
?>
i am using sessions. but it is working only for general form.date search and keyword forms not working.
for date search i am using following code.

Code: Select all

<?php
$_SERVER['PHP_SELF']."?search_date=$search_date";
?>
but search_date value not coming back. please give some idea.

thanks,
qumar.

Everah | Please use the appropriate bbCode tags when posting code in the forums.
Post Reply