Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

PHP help...HTTP_REFERER

Guest
Jan 23, 2012 Jan 23, 2012

Copy link to clipboard

Copied

Ok, once again I am completely stumped.

Im sure someone can answer this pretty easily - but for some reason I am having major issues.

Here is the code:

session_start();

include_once "folder/connect_to_mysql.php";

$ref = parse_url($_SERVER['HTTP_REFERER']);

$host = $ref["host"];

if ($host != "www.(my site here).com") {

          echo "Crap! Something broke on the backend...";

          exit();

}

needless to say, it always echos out the "Crap! Something broke on the backend..."

I cannot figure out why though.

Any ideas?

TOPICS
Server side applications

Views

502
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 23, 2012 Jan 23, 2012

Copy link to clipboard

Copied

LATEST

Have you tried to echo the actual value of the referrer ($ref), or of the $host value? That will tell you why it is happening.

A likely cause is that the referer is being blocked. Browsers, firewalls, and proxy servers can all block http referers, which is why it's usually not a good idea to rely upon their values. What are you planning to use the referer value for?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines