Re: request_uri alternative
- From: "C. (http://symcbean.blogspot.com/)" <colin.mckinnon@xxxxxxxxx>
- Date: Wed, 17 Dec 2008 05:15:45 -0800 (PST)
On 17 Dec, 04:06, FutureShock <futuresho...@xxxxxxx> wrote:
My server host for whatever reason is not dishing out the correct
request_uri. It is displaying the page viewing and not the page it was
linked from.
So...what I am looking for is an alternative to determine the previous
page from the site. (nothing from external).
This is what I have so far at the top of each page.
session_start();
// Set previous page
if(isset($_SESSION['current_page'])) {
$previous_page = $_SESSION['current_page'];}
$_SESSION['current_page'] = $_SERVER['PHP_SELF'];
This works so far with limited testing.
Has anyone used a different method that they know that works?
Can you see any reason why my method may fail?
Thanks
Scotty
There's several ways to solve the problem. Your solution will get
confused if the user opens more than one window and also has the
overhead of maintaining a session for every user. An alternative
approach would be to rewrite the URLs in all the links using
javascript to add a parameter identifying the current page, and add a
hidden field to any POST form with the same. But this does not address
the core issue - why do you need this information?
C.
.
- Follow-Ups:
- Re: request_uri alternative
- From: FutureShock
- Re: request_uri alternative
- From: FutureShock
- Re: request_uri alternative
- From: FutureShock
- Re: request_uri alternative
- References:
- request_uri alternative
- From: FutureShock
- request_uri alternative
- Prev by Date: Re: Type casting
- Next by Date: Re: request_uri alternative
- Previous by thread: Re: request_uri alternative
- Next by thread: Re: request_uri alternative
- Index(es):
Relevant Pages
|