Results 1 to 5 of 5

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

Hybrid View

  1. #1

    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.


  2. #3
    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

  3. Thanks Xrvel I am definitely going to use this on my list...

  4. #5

Similar Threads

  1. [WTS] Proxy Owners Only -
    By iowadawg in forum Links
    Replies: 1
    Last Post: 8 March, 2011, 19:50 PM
  2. Question for proxy list owners
    By ruben in forum Web Proxies
    Replies: 5
    Last Post: 14 November, 2009, 05:57 AM
  3. Guides for New Proxy Owners
    By Will.Spencer in forum Web Proxies
    Replies: 17
    Last Post: 1 November, 2009, 08: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, 16: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
  •