help with phpproxy

Discussion in 'HTML & Website Design' started by izlik, Dec 15, 2007.

  1. #1
    hey there, i need help from someone who knows how phpproxy works and can answer the question bellow.

    i am using phpproxy and i have a problem with users stealing my bandwith trough hotlinking. i searched a bit and found the code bellow that where to be pasted in into my index.php files right after <?php
    but when i do this and upload the file my page blanks out and wont load when i go to it anymore, and once i ofc remove the code it works, anyone know why ? :/

    and yes i have changed $domain to my domain! :p


    $domain=”myproxy.com”;
    
    // If no request:
    if($_GET[’q']!=”"){
    // Get referer
    $referer=$_SERVER[’HTTP_REFERER’];
    // Check to see if referer is not the proxys domain
    $count=substr_count($referer,$domain);
    // If there is an outside referer:
    if($count==0){
    // If there is a request:
    if($_GET[’q']!=”"){
    // Redirect to homepage and finish script
    header(”Location: http://www.” . $domain . “/”);
    exit();
    }
    }
    }
    Code (markup):
     
    izlik, Dec 15, 2007 IP
  2. jmhyer123

    jmhyer123 Peon

    Messages:
    542
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this code (I suggest you copy and paste it ;)), I tested it on a default install of PHProxy so it should work.

    
    $domain = "myproxy.com";
    
    // If no request:
    if($_GET['q'] != ""){
    // Get referer
    $referer=$_SERVER[’HTTP_REFERER’];
    // Check to see if referer is not the proxys domain
    $count=substr_count($referer,$domain);
    // If there is an outside referer:
    if($count == 0){
    // If there is a request:
    if($_GET['q'] != ""){
    // Redirect to homepage and finish script
    header('Location: http://www.' . $domain . '/');
    exit();
    }
    }
    }
    
    Code (markup):
    Hope it helps, if not let me know and i'll try again ;)
     
    jmhyer123, Dec 15, 2007 IP
  3. izlik

    izlik Well-Known Member

    Messages:
    2,399
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    185
    #3
    hey, now it works. but try to use it, now it only goes to the main page all the time :( cant surf to any page after adding that :(

    http://www.proxylure.com/test/
     
    izlik, Dec 15, 2007 IP
  4. jmhyer123

    jmhyer123 Peon

    Messages:
    542
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #4
    try changing $domain = "myproxy.com"; to $domain = "http://www.proxylure.com/test/";

    I know you probably changed it to your domain but add /test/ to the the end if you haven't already.

    That should make it work however, if you move you proxy from /test/ to the root of your domain then you will have to take the /test/ off the end of it.
     
    jmhyer123, Dec 15, 2007 IP
  5. izlik

    izlik Well-Known Member

    Messages:
    2,399
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    185
    #5
    izlik, Dec 15, 2007 IP
  6. jmhyer123

    jmhyer123 Peon

    Messages:
    542
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #6
    hmm... I'm not sure what else would be causing it to not allow you to browse. What is happening is it thinks you are "hotlinking" or "leeching" bandwidth from yourself (lol) because it doesn't show that the referer is from your site (which it would be if you were using your proxy to browse to another site rather than "hotlinking" through your proxy to another site.
     
    jmhyer123, Dec 15, 2007 IP
  7. pickaso1

    pickaso1 Banned

    Messages:
    26
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    try changing $domain = "myproxy.com"; to $domain = "http://www.proxylure.com/test";
     
    pickaso1, Dec 15, 2007 IP
  8. izlik

    izlik Well-Known Member

    Messages:
    2,399
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    185
    #8
    i now removed the code you quoted and tryed it now, it works, someting in that code that is supposed to "deny" hotlinking messes it up :'(


    that wont work as if you look at this line! header('Location: http://www.' . $domain . '/');
    it put that in automaticly.
     
    izlik, Dec 15, 2007 IP