...

View Full Version : Resolved http referrer always NULL - permissions problem?



Morf
04-29-2011, 05:50 AM
Hello,

I didn't post this in the php coding section because I'm 99% sure this is not a code problem but a configuration problem. Will post code for reference anyway.

I'm adding some custom code to a Wordpress installation to try to determine if a user is from Twitter, and if so, to display a custom message. I think my code is right but it appears that the $_server['HTTP_REFERER'] is always null for some reason. I am wondering if it is a permissions problem or something similar because according to my stats tracking software, the referrer is not null. Anyway here's my code:



<?php
$pos = strpos($_server['HTTP_REFERER'], "twitter");
if ($pos === false)
{
echo "NOT FROM TWITTER";
echo $_server['HTTP_REFERER'];
}
else
{
echo "TWITTER TRAFFIC DETECTED";
}
?>


It always returns "NOT FROM TWITTER" and a blank REFERER, but again, my stats software tells me that the referer is not blank. Can the script not access it? Just to test if it was a wordpress problem, I made a raw php file with the following code:


<?php
echo $_server['HTTP_REFERER'];
?>

That's it, simply echo REFERER to the page. But again, it comes up blank, despite my analytics correctly detecting and reporting a REFERER.

Any help is appreciated. Thanks.

EDIT TO ADD: Script's permissions are 0644 - have tested with both IE and Firefox, default settings - register globals is ON

Morf
04-29-2011, 07:11 AM
Update:

HOLY CRAP I'M A DUNCE. Didn't capitalize $_SERVER

Sorry.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum