PHP Coder? Quick Question

Discussion in 'BlackHat Lounge' started by nam6641, Sep 21, 2009.

  1. nam6641

    nam6641 Supreme Member

    Joined:
    Nov 15, 2008
    Messages:
    1,478
    Likes Received:
    916
    Location:
    East Coast
    I want to make a simple php page that says if someone was referred by a certain base URL (meaning if they were referred by www.mysite.com or www.mysite.com/page15, etc...) to send them to one page, otherwise send them to another page. Thanks for whoever takes a minute to share the coding.
     
  2. IamNomad

    IamNomad Junior Member

    Joined:
    Mar 27, 2009
    Messages:
    135
    Likes Received:
    22
    Location:
    ┌∩┐(◕_◕)┌∩┐
    This SHOULD do the trick. let me know if there is any issues with it.

    PHP:
     <?php
        $referer 
    $_SERVER['HTTP_REFERER']; 
            if ( 
    $referer == 'http://www.somesite.com/'
                  {   
    header("Location: http://www.somewherelse.com"); }
           else
                  { 
    header("Location: http://coolpageeveryonesees.com");}    
      
    ?> 
    EDIT: i read more clearly what you want. see hte update
     
    • Thanks Thanks x 1
    Last edited: Sep 21, 2009
  3. WickednDivine

    WickednDivine Regular Member

    Joined:
    Jul 29, 2008
    Messages:
    471
    Likes Received:
    345
    about as simple as it gets

    Code:
    <?php
    
    if( preg_match('/mysite.com/', $_SERVER['HTTP_REFERER']) ) {
        header("Location: http://www.somepage.com");
    }
    else {
        header("Location: http://www.someotherpage.com");
    }
    
    ?>
    
     
    • Thanks Thanks x 1
  4. Siek

    Siek Regular Member

    Joined:
    Feb 4, 2008
    Messages:
    456
    Likes Received:
    294
    another way to approach the same idea is through cookies..

    check out this thread:

    Code:
    http://www.blackhatworld.com/blackhat-seo/cookie-stuffing/75610-adbrite-cookie-stuffing-method-how-earn-thousands-per-week-cj.html
    
     
  5. nam6641

    nam6641 Supreme Member

    Joined:
    Nov 15, 2008
    Messages:
    1,478
    Likes Received:
    916
    Location:
    East Coast
    thanks... i got someone who is stealing my content and i have a way to use this to spit in their face (sending the thief's traffic to a gay porno site), lol...
     
  6. IamNomad

    IamNomad Junior Member

    Joined:
    Mar 27, 2009
    Messages:
    135
    Likes Received:
    22
    Location:
    ┌∩┐(◕_◕)┌∩┐

    if all his traffic is coming from one location and its not yours. do one better. block the IP address at a server level

    edit /etc/sysconfig/iptables .. for example the if you ran a redhat/centos box and the traffic IP was 192.168.1.1

    Code:
     -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -s 192.168.1.1 -j DROP 
     
  7. nam6641

    nam6641 Supreme Member

    Joined:
    Nov 15, 2008
    Messages:
    1,478
    Likes Received:
    916
    Location:
    East Coast
    I dont think that will work for what is happening.

    He is stealing my content, putting it on his site. Within my content are links to a site (which i actually own but he doesn't know) so when people try to visit this site from his site the are going to wind up with a cock in their face. I may post a note with a message about him stealing content and then do a 2 second delayed refresh to redirect the cock in their face.
    Hopefully they will all hate this dude's site then.
     
  8. IamNomad

    IamNomad Junior Member

    Joined:
    Mar 27, 2009
    Messages:
    135
    Likes Received:
    22
    Location:
    ┌∩┐(◕_◕)┌∩┐
    i recommend meat spining the guy