<?php
/**
 * Wideorbit blacklist
 * 
 * @author Janaki
 * 11/07/2016
 * 
 */

class _WOBlacklist
{

    function __construct()
    {
        
    }


    /**
     * Check if url is blacklisted for wideorbit. 
     * Caller has to pass the db to read cluster and manage the caching
     * @param string $url
     * @param unknown $db
     */
    function isBlacklisted($url = "", $db)
    {
        $sql = "SELECT * FROM `rep_wideorbit_blacklist` where url like  '%$url%' OR INSTR('$url', url)>0 ";
        $res = mysql_query($sql, $db);
        if(mysql_num_rows($res)>0)
            return true;
        else
            return false;
    }
}

/* include_once 'lib/php/include/db.php';
$db = ConnectToReadCluster();
$ref_dom = "http://www.google.co.in.br";

$wobl = new _WOBlacklist();
if($wobl->isBlacklisted($ref_dom, $db)){
    echo "BLACKLISTED";
}
else{
    echo "WHITELISTED";
} */
?>