Results 1 to 5 of 5

Thread: Code To Ban Domain (for Proxy List Owners)

  1. #1
    xrvel's Avatar
    xrvel is offline Newbie Net Builder
    Join Date
    Mar 2009
    Location
    Xrvel.com
    Posts
    37
    Blog Entries
    1
    Thanks
    19
    Thanked 19 Times in 8 Posts

    Lightbulb Code To Ban Domain (for Proxy List Owners)

    You can try this. I made it pretty human readable and human friendly
    If you own a proxy list, you can ban some domain, blogspot.com, *.co.cc, *.cn, *.something, etc
    PHP Code:
    <?php
    /*
     * Author : xrvel (xrvel.com)
     */
    // MAIN CODE START
    function isBanned($url) {

        
    // Enter banned URL here
        
    $ban_reg_exp = array(
            
    'blogspot.com',
            
    '.cn',
            
    '.co.cc',
            
    'some-thing.com'
        
    );

        
    $ban_reg_exp '/('.friendlyRegExp(implode('|'$ban_reg_exp)).')+$/i';
        
    //echo $ban_reg_exp;

        
    $url urldecode($url);
        
    $url preg_replace('/^http(s)?\:\/\/www\./i''http\\1://'$url);// remove "www."
        
    $parsed_url parse_url($url);
        
    //echo '<pre>', print_r($parsed_url, true), '</pre>';
        
    $host $parsed_url['host'];
        return (bool)
    preg_match($ban_reg_exp$host);
    }

    function 
    friendlyRegExp($s) {
        
    $s trim($s);
        
    $s str_replace('.''\.'$s);
        
    $s str_replace('-''\-'$s);
        return 
    $s;
    }
    // MAIN CODE END

    //
    // Let's test our code with some URLs
    //
    $url 'https://www.test1.com//test.com?awioduawd';
    echo 
    $url' ::: ';
    if (
    isBanned($url)) {
        echo 
    'IS BANNED';
    } else {
        echo 
    'is allowed...';
    }

    echo 
    '<br />';

    $url 'https://www.test1.cn/test.com?axasa';
    echo 
    $url' ::: ';
    if (
    isBanned($url)) {
        echo 
    'IS BANNED';
    } else {
        echo 
    'is allowed...';
    }

    echo 
    '<br />';

    $url 'https://www.test1-something%2Ecn/test.com?axasa';
    echo 
    $url' ::: ';
    if (
    isBanned($url)) {
        echo 
    'IS BANNED';
    } else {
        echo 
    'is allowed...';
    }

    echo 
    '<br />';

    $url 'https://www.test1-something.blogspot.com/test.com?axasa';
    echo 
    $url' ::: ';
    if (
    isBanned($url)) {
        echo 
    'IS BANNED';
    } else {
        echo 
    'is allowed...';
    }

    echo 
    '<br />';

    $url 'https://www.hello.cn.more.com/test.com?axasa';
    echo 
    $url' ::: ';
    if (
    isBanned($url)) {
        echo 
    'IS BANNED';
    } else {
        echo 
    'is allowed...';
    }

    echo 
    '<br />';

    $url 'http://test1.cn/test.com?axasa';
    echo 
    $url' ::: ';
    if (
    isBanned($url)) {
        echo 
    'IS BANNED';
    } else {
        echo 
    'is allowed...';
    }

    echo 
    '<br />';
    ?>
    The output of above example is :
    Code:
    https://www.test1.com//test.com?awioduawd ::: is allowed...
    https://www.test1.cn/test.com?axasa ::: IS BANNED
    https://www.test1-something%2Ecn/test.com?axasa ::: IS BANNED
    https://www.test1-something.blogspot.com/test.com?axasa ::: IS BANNED
    https://www.hello.cn.more.com/test.com?axasa ::: is allowed...
    http://test1.cn/test.com?axasa ::: IS BANNED
    Last edited by xrvel; 20 June, 2009 at 15:31 PM.
    . Xrvel . Free Proxy List Script (on Google Code) .

  2. Thanked by:

    m42 (20 June, 2009), WebEvader (20 June, 2009), Will.Spencer (20 June, 2009)

  3. #2
    Join Date
    Jan 2009
    Posts
    351
    Thanks
    7
    Thanked 18 Times in 18 Posts

  4. #3
    xrvel's Avatar
    xrvel is offline Newbie Net Builder
    Join Date
    Mar 2009
    Location
    Xrvel.com
    Posts
    37
    Blog Entries
    1
    Thanks
    19
    Thanked 19 Times in 8 Posts
    Quote Originally Posted by geeknb View Post
    Wow! Thank you very much!
    I'll add this to my proxy listing site.
    You're welcome. Let's clean our list from .co.cc
    . Xrvel . Free Proxy List Script (on Google Code) .

  5. #4
    WebEvader's Avatar
    WebEvader is offline Moderator
    Join Date
    Jan 2009
    Posts
    397
    Blog Entries
    2
    Thanks
    166
    Thanked 26 Times in 21 Posts
    Thanks Xrvel I am definitely going to use this on my list...

  6. #5
    thesyndicate is offline Newbie Net Builder
    Join Date
    Jul 2009
    Location
    NET<>DP
    Posts
    138
    Thanks
    14
    Thanked 5 Times in 4 Posts

Similar Threads

  1. [WTS] Proxy Owners Only -
    By iowadawg in forum Links
    Replies: 1
    Last Post: 8 March, 2011, 18:50 PM
  2. Question for proxy list owners
    By ruben in forum Web Proxies
    Replies: 5
    Last Post: 14 November, 2009, 04:57 AM
  3. Guides for New Proxy Owners
    By Will.Spencer in forum Web Proxies
    Replies: 17
    Last Post: 1 November, 2009, 07:31 AM
  4. Replies: 17
    Last Post: 8 June, 2009, 19:00 PM
  5. Beware Proxy Owners!
    By Aquarezz in forum Web Proxies
    Replies: 15
    Last Post: 24 February, 2009, 15:47 PM

Tags for this Thread

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
  •