FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » $referrer = $_SERVER['HTTP_REFERER'] echo
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: $referrer = $_SERVER['HTTP_REFERER'] echo [message #181953 is a reply to message #181951] Thu, 27 June 2013 21:40 Go to previous messageGo to previous message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma:
Senior Member
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?

You should be aware that it is possible that a UA doesn't sent a
referrer header.

> 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";
> }
> -----------------------------

The double )) is wrong; just use a single ). You may consider to use
only simple expressions for an if expression, e.g.:

$cameFromExpectedPage = substr($referrer, -13) === 'formcheck.php';
if ($cameFromExpectedPage) {
echo 'Something showed up';
}

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to change old ereg?
Next Topic: page "hit" counter
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Jan 15 22:54:59 GMT 2025

Total time taken to generate the page: 0.04365 seconds