Need a script to prevent...

Discussion in 'PHP' started by t0ny, Apr 8, 2007.

  1. #1
    I need a script to prevent my site from being displayed on an autosurf rotator site or any other type of traffic exchange.

    I tried sending a redirect in the .htaccess file to a 301, but it has not worked.


    What can I do?
     
    t0ny, Apr 8, 2007 IP
  2. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is this code correct and will it work?

    <?php
    $d = $_SERVER['HTTP_REFERER'];
    if($d=="autosurf.com")
    {
    // block it
    }
    ?>
     
    t0ny, Apr 8, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    HTTP_REFERER is sent by the browser, and can be easily modified or disabled. I could guess that this rotator site won't send a referer at all, so people don't block it. However, it's worth a try:

    
    
    if (preg_match('/autosurf\.com/', $_SERVER['HTTP_REFERER']))
    {
         exit();
    }
    
    
    PHP:
     
    nico_swd, Apr 8, 2007 IP
  4. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Where would I install this file in a forum?

    I'm hosting a forum with vbulletin software.
     
    t0ny, Apr 8, 2007 IP
  5. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    What does preg_match do in php code?
     
    t0ny, Apr 8, 2007 IP
  6. commandos

    commandos Notable Member

    Messages:
    3,648
    Likes Received:
    329
    Best Answers:
    0
    Trophy Points:
    280
    #6
    Tony ... go to your browser

    type :

    g
    o
    o
    g
    l
    e
    .
    c
    o
    m

    then in the search field type : preg_match

    then "i'm feeeeling lucky"

    you will get your answer ...
     
    commandos, Apr 8, 2007 IP
    jdR!pper likes this.
  7. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hmmmmm.....ok.

    Thanks..lol.
     
    t0ny, Apr 8, 2007 IP
  8. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Wow, I found what it means and what it does. Thanks a lot. This forum is amazing.

    This means a lot to me.

    Thank you! :)

    Now one more thing.

    Using vbulletin software to host a forum, how would I write this code to function in the vb templates?

    Or,

    Should this code be inserted into a file in the forum root folder?
     
    t0ny, Apr 8, 2007 IP
  9. hamidof

    hamidof Peon

    Messages:
    619
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #9
    It's better you don't touch VB's source code, search for vBulletin hook system.
     
    hamidof, Apr 8, 2007 IP
  10. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    What is it about the hook system that is different and might help me here?
     
    t0ny, Apr 8, 2007 IP
  11. t0ny

    t0ny Banned

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Hello everyone! I have some great news. I found the code that I was after, tested it and it worked!

    Thanks a lot to all of you who helped me out.

    I really appreciate it.

    :)
     
    t0ny, Apr 8, 2007 IP