Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2006
    Posts
    47
    Thanks
    2
    Thanked 0 Times in 0 Posts

    http referrer always NULL - permissions problem?

    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 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 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
    Last edited by Inigoesdr; 04-29-2011 at 04:26 PM.

  • #2
    New Coder
    Join Date
    Apr 2006
    Posts
    47
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Update:

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

    Sorry.
    Last edited by Morf; 04-29-2011 at 06:47 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •