Results 1 to 7 of 7

Thread: Antileech

  1. #1
    Join Date
    Nov 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Antileech

    Hello all,

    I've a problem with my script.
    I'm using an antileech script, it's using mysql
    Path file to download categories in config: ./stored/
    I've uploaded a test file (test.rar) to category folder ( /stored/appz/test.rar)
    I got the file link from admin cp: <a href="http://mydomain/dll/leech?cat=Appz&file=test.rar">test.rar</a>
    When I click on the "download" button, here I go: http://mydowmain/dll/download/a69b2c...e56f1/test.rar
    and I got "Íåâåðíûé çàïðîñ!" error..
    Whats wrong?

    CODEfunction GetParams () {
    $PHP_SELF = $_SERVER['PHP_SELF'];
    $params = substr(getenv('REQUEST_URI'), -(getenv('REQUEST_URI')-strlen($_SERVER['SCRIPT_NAME'])));
    $param = explode('/', $params);
    array_shift($param);
    if (sizeof($param) < 2) {
    echo "Íåâåðíûé çàïðîñ!".NL;
    exit;
    }
    return $param;
    }


    Íåâåðíûé çàïðîñ!: that means Incorrect demand or Invalid URL

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Well, anti-leech by design is to make visitors go to pages on your site by link only... seems you are also checking for refer page, which isn't needed.

    maybe try this:

    Code:
    <?
    // this parse's into the following: $url["scheme"], $url["host"], $url["path"]
    $url = parse_url($HTTP_REFERER); 
    
    //$url["host"] could be in uppercase so.. new var to lower
    $check=strtolower($url["host"]);
    
    // checks proper domain only
    // no reffer needed
    if ($check!='your.domain.com')
    {
    echo "<meta http-equiv=\"refresh\" content=\"0; url=http://your.domain.com/warn_page_or_redirect\">";
    exit;
    }
    ?>

    Just change the domain to yours and paste into all pages needed. Visitor can not access a page directly through the URL
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I disagree with this:
    Code:
    echo "<meta http-equiv=\"refresh\" content=\"0; url=http://your.domain.com/warn_page_or_redirect\">";
    Use:
    Code:
    header("Location: http://your.domain.com/warn_page_or_redirect");
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by Twey
    I disagree with this:
    Well you know best, I have been trying (learning) php for only about 2 months
    and serious about it for about 1 week


    Consider this another lesson learned!
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Should've given a reason, sorry. Some browsers don't support the meta refresh, and some people disable it. Hence, sending an HTTP Location: header is better.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD
    <?
    It's generally considered better to avoid short tags. Use

    Code:
    <?php
    instead.

    $url = parse_url($HTTP_REFERER);
    Expecting register_globals to be on is also inadvisable. Use the $_SERVER superglobal:

    PHP Code:
    $url parse_url($_SERVER['HTTP_REFERER']); 
    // checks proper domain only
    // no reffer needed
    if ($check!='your.domain.com')
    This doesn't allow for instances where no referrer information is present. Users can stop their browsers sending it, and some proxy servers strip it. A simple check would be:

    PHP Code:
    if($_SERVER['HTTP_REFERER']) {
      
    /* Rest of the code nested here */


    Quote Originally Posted by Twey
    I disagree with [using META refresh]
    So do I.

    Note that if the intention is to warn the user, it would be best to send a 303 Forbidden response. Starting a PHP file with:

    PHP Code:
    <?php

    header
    ('HTTP/1.1 303 Forbidden');
    ?>
    would achieve that.

    The other way to handle this is through URL rewriting. The mod_rewrite guide in the Apache documentation gives an example for this very situation:

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://www.quux-corp.de/~quux/.*$ [NC]
    RewriteRule .*\.gif$        -                                    [F]
    Just change the expected Referer [sic] string (the !^ start and .*$ end should remain) and the file extension. You could include multiple extensions with:

    Code:
    RewriteRule .*\.(?:gif|jpeg|jpg)$      -                         [F]
    Mike

  7. #7
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    WOW, thanks for the lesson! Learning lots!

    I was (still am) waiting for any help with my question and saw this post unanswered, so I dug into my snippets and lesson pages, and put this together. I still don't fully understand the mod_rewrites so I tend to steer away from those.

    All of this, and the OP will prolly not check back, LOL!!

    But HEY! I learned something and THAT is important!
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •