Re: HTTP_REFERER or alternative
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Thu, 13 Nov 2008 06:48:06 -0500
Álvaro G. Vicario wrote:
Jerry Stuckle escribió:Álvaro G. Vicario wrote:mrsmithq escribió:I have a page that has this logic in it:
//We can call it access.php
if (!isset($_SESSION['user'])){
header("Location:index.php");
exit();
}
//Here is the index.php
echo "<br>" . $_SERVER['HTTP_REFERER'];
The index.php displays this when it is called from the access.php:
Notice: Undefined index: HTTP_REFERER in /usr/local/apache2-
development/htdocs/index.php on line
How can I go to access.php and then is the user object is not set, it
forwards me to the index page and the index page now knows where it
came from so that the index page acan follow some logic and return to
the access.php page?
Just add a new parameter:
$return = $_SERVER['REQUEST_URI'];
header('Location: http://example.com/index.php?return=' .
rawurlencode($return));
Even worse than using HTTP_REFERER.
The reason is not obvious to me (if it was, I would not have recommended it). Sites like Gmail and Yahoo do it this way:
https://www.google.com/accounts/ServiceLogin? ... continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl
http://us.rd.yahoo.com/ ... done=http%3a//groups.yahoo.com
... so I never thought it could be so wrong. Can you elaborate on this?
Anyone can put anything in the URL.
Not only are Yahoo and GMail are using it for something entirely different, but "someone else is doing it" is NEVER a good reason. I don't care who it is.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- Re: HTTP_REFERER or alternative
- From: "Álvaro G. Vicario"
- Re: HTTP_REFERER or alternative
- References:
- HTTP_REFERER or alternative
- From: mrsmithq
- Re: HTTP_REFERER or alternative
- From: "Álvaro G. Vicario"
- Re: HTTP_REFERER or alternative
- From: Jerry Stuckle
- Re: HTTP_REFERER or alternative
- From: "Álvaro G. Vicario"
- HTTP_REFERER or alternative
- Prev by Date: Re: Publish to live site from Subversion
- Next by Date: Re: Echo in Echo
- Previous by thread: Re: HTTP_REFERER or alternative
- Next by thread: Re: HTTP_REFERER or alternative
- Index(es):
Relevant Pages
|