PHP Proxy Detect - Possible?

Discussion in 'PHP' started by M12, Jan 7, 2010.

  1. #1
    I was sat here wondering, with hardly no knowledge of PHP. Would it be possible to detect a proxy and block it - without a list of host names, ip's and stuff. I'd like to see if any of you more knowledgable, more experienced users think it is possible, your opinion on the matter.

    Well, that's all.
     
    M12, Jan 7, 2010 IP
  2. luckymurari

    luckymurari Active Member

    Messages:
    629
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    90
    #2
    Its not possible. After all, a proxy si just another computer. If you are speaking about a webproxy like hidemyass etc., then you can use framebreaker for atleast some respite. Though, that won't give total blockign of web proxiews also, only those with frame will be disabled.
     
    luckymurari, Jan 7, 2010 IP
  3. iAreCow

    iAreCow Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #3
    I guess Glype and/or PHProxy had some User agent defined, so you can block them
    <?php
    $agent = $_SERVER["HTTP_USER_AGENT"]; // Define the user agent (browser name)
    if(preg_match("/glype|phproxy/",$agent) die("You're on proxy :P"); // IF glype OR phproxy can be found in user agent, kill the script with an error message
    else { echo "Here's your content, you don't really have to use else here, you could just continue with your script because IF glype or phproxy is detected in user agent, script will die with an error message"; }
    ?>
    PHP:
     
    iAreCow, Jan 7, 2010 IP
  4. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #4
    its not easy to block a proxy coz proxies were made to be like normal user
     
    Bohra, Jan 7, 2010 IP
  5. astkboy2008

    astkboy2008 Peon

    Messages:
    211
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    but people use proxy to get the blocked site
     
    astkboy2008, Jan 8, 2010 IP
  6. CoreyPeerFly

    CoreyPeerFly Notable Member Affiliate Manager

    Messages:
    394
    Likes Received:
    24
    Best Answers:
    5
    Trophy Points:
    240
    #6
    The above code will error. You're missing a ) for the preg_match condition. And I'm pretty sure that code won't detect those proxies. The user agent will remain whatever your browser is set at, whether you're using a proxy or not.
     
    CoreyPeerFly, Jan 8, 2010 IP
  7. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #7
    agree if it was easy like user agent to detect a proxy i am sure sites like paypal would implement it too
     
    Bohra, Jan 8, 2010 IP
  8. iAreCow

    iAreCow Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #8
    @CoreyPeerFly
    Sorry, I always miss something without syntax highlighting :p
    And since they use Curl to do the browsing part, your User Agent wont be sent to the remote site (in case the proxy script doesn't fetch yours and then uses it, I haven't been into the code that hard so I've no idea)
     
    iAreCow, Jan 8, 2010 IP
  9. xenon2010

    xenon2010 Peon

    Messages:
    237
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    blocking proxies is almost impossible.
    proxy is another normal computer. you cannot block normal PC..
     
    xenon2010, Jan 8, 2010 IP