blank http referrer

Discussion in 'PHP' started by skiddybox, Jan 1, 2013.

  1. #1
    I'm trying to blank the referrer but my code isn't working (this is for my own testing purposes only)

    1st call the script with a htaccess file from https to http (which should blank it)

    htaccess:
    RewriteEngine On
    RewriteRule image.png https://dom1.comscript1.php [R,L]
    Code (markup):
    script1:
    <?php 
    $url = 'http://dom2.com/script2.php';
    header("Location: ".$url);
    ?>
    Code (markup):
    script2:
    <?php
    
    $show = 1;
    if (!empty($_SERVER['HTTP_REFERER'])) {
        $goodreferer = 0;
    }
    else {
        $goodreferer = 1;
    }
    
    if ($show == 1 && $goodreferer == 1) {
    	
    	header('Location:' . http://someurl.com);
    	
    }
    else {
       
    	header('Location:' . $image);
    	
        exit;
    	}
    
    ?>
    Code (markup):

     
    skiddybox, Jan 1, 2013 IP
  2. ogah

    ogah Member

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    open with php proxy and check the option hide referer
     
    ogah, Jan 1, 2013 IP
  3. skiddybox

    skiddybox Member

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #3
    i see, thanks
     
    Last edited: Jan 1, 2013
    skiddybox, Jan 1, 2013 IP
  4. BarbaraMibram

    BarbaraMibram Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    Thank you so much its always working...
     
    BarbaraMibram, Jan 2, 2013 IP
  5. b3nder

    b3nder Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #5
    The referrer value can't be changed on the server side, all you can do is trick the browser into giving a null referrer. Hence your php script won't work, why don't you use redirect through short linking service ? I'm using a few including lynkto.net, linkonym.com and so on.
     
    b3nder, Aug 7, 2014 IP
  6. chrisnagios

    chrisnagios Member

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #6
    yes, shortner links is the best to anonymize source
     
    chrisnagios, Aug 11, 2014 IP