Re: request_uri alternative



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
.



Relevant Pages

  • Re: They lost, cant get over it
    ... Voice of Reason wrote: ... Considering nothing but your own personal experiences, viewing what you ... equivalent of ten pounds of shit in a five pound sack. ...
    (alt.guitar.amps)
  • Re: Over the Garden Fence
    ... Another good reason to be out in the garden. ... Coloribus gustibus non disputatum ... MY COMPUTER SAYS THE PAGE IS NOT AVAILABLE FOR VIEWING. ...
    (rec.gardens.edible)
  • Re: "Canterburys Law" - Guilty
    ... compelling viewing. ... been too spoiled by Damages to accept any other law show that comes ... You can't reason with someone whose first line of argument is ...
    (rec.arts.tv)
  • Re: Sky+ Box for Europe fringe areas/HD Upgrade TDS470N?
    ... So in summary not much reason to splash out the extra for the pvr3 ... Particularly if you just want to be able to manage your viewing ...
    (uk.tech.tv.sky)
  • request_uri alternative
    ... 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. ...
    (comp.lang.php)