Re: request_uri alternative
- From: FutureShock <futureshockx@xxxxxxx>
- Date: Wed, 17 Dec 2008 06:17:13 -0800
C. (http://symcbean.blogspot.com/) wrote:
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.
The reason for this was to be able to put the user back on the page after a link took him elsewhere (in the site). Such as a login page, then when done, go back to the page you where on when you clicked the sign-in link.
I have not yet fully thought this out, just playing with some code.
As far as multiple pages. The server does not know the same person has multiple browsers/tabs open, correct. So it should serve each request from each browser independent of each other. Now I have not tested this, but I will.
I am trying to stay away from JS as much as possible.
As far as request_uri, maybe I was thinking it behaved differently. It was my thought that it held the value of the page the linked the page I am viewing.
I know referrer does that, but I would need to parse it to ensure it was from my site prior to using the value.
Thanks for your input.
Scotty
.
- References:
- request_uri alternative
- From: FutureShock
- Re: request_uri alternative
- From: C. (http://symcbean.blogspot.com/)
- request_uri alternative
- Prev by Date: Re: request_uri alternative
- Next by Date: Re: FTP isn't working for TSO JES
- Previous by thread: Re: request_uri alternative
- Next by thread: Re: request_uri alternative
- Index(es):
Relevant Pages
|