Re: $referrer = $_SERVER['HTTP_REFERER'] echo [message #181954 is a reply to message #181951] |
Thu, 27 June 2013 21:52 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 6/27/2013 5:23 PM, Twayne wrote:
> I have what's probably a simple and very basic question.
>
> My goal is to see where a visitor sending a form-email with mail() on
> win 7 and XAMPP - PHP 5.3.5, came from. e.g. did he come here from the
> right page or just barge into this page as his landing page?
> My php.ini seems to be OK and I've not changed any other config
> files. All other "If's" work OK and I'm now baffled.
>
> This works fine:
> -------------------
> $referrer = $_SERVER['HTTP_REFERER'];
> echo "<br /><br /> Visitor came here from : ". substr($referrer, -13,
> 13)."<br />";
> ------------------
>
> But this will not work:
> ------------------------------
> if(substr($referrer, -13, 13))==="formcheck.php") {echo "Something
> showed up";
> }
> -----------------------------
>
> It results in the following error:
> ------------
> Parse error: syntax error, unexpected T_IS_IDENTICAL in
> C:\xampp\htdocs\formcheck2.php on line 36
> ------------
> when when run on my local XAMPP Server.
>
> I have tried everything I can think of to get it to work: Interchaning
> the vars on each side of "===", using "==", moved the closing parens
> around, with and without curly brackets, etc. etc. etc. I've got myself
> so confused now I feel really stuck.
>
> Can anyone straighten me out?
>
> TIA,
>
> Twayne
>
Like anything else sent by the client, you can't trust
$_SERVER['HTTP_REFERER']. It may or may not exist, and if it does, it
may or may not contain the actual referrer page.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|