$action = $_REQUEST['act'];
$error = '';
$data = '';
$par_id = $_REQUEST['par_id'];
switch ($action) {
    case 'get_add_page':
        $page = GetPage();
        $data = array('page' => $page);
        break;
    case 'get_cat':
        $page = Get_Category('', $_REQUEST['ch_ubani']);
        $data = array('page' => $page);
        break;
    case 'get_edit_page':
        $cat_id = $_REQUEST['id'];
        $page = GetPage(GetCategory($cat_id));
        $data = array('page' => $page);
        break;
    case 'get_list':
        $count = $_REQUEST['count'];
        $hidden = $_REQUEST['hidden'];
        $rResult = mysql_query("SELECT\t`info`.`id`,\r\n\t                                    `info`.`id`,\r\n                                \t\tIF(info.parent_id = 0,`info`.`name`,(SELECT `name` FROM `service_center` WHERE `id` = `info`.`parent_id`)),\r\n                                        IF(info.parent_id = 0,'',(SELECT `name` FROM `service_center` WHERE `id` = `info`.`id`)),\r\n\t                                    `branch`.`name`\r\n\t\t\t\t\t\t\t    FROM\t`service_center` AS `info`\r\n\t                            LEFT JOIN branch ON branch.id = info.branch_id\r\n\t    \t\t\t\t\t\tWHERE\t`info`.`actived` = 1");
        $data = array("aaData" => array());
        while ($aRow = mysql_fetch_array($rResult)) {
            $row = array();
            for ($i = 0; $i < $count; $i++) {
                /* General output */
                $row[] = $aRow[$i];
                if ($i == $count - 1) {
                    $row[] = '<div class="callapp_checkbox">
                                  <input type="checkbox" id="callapp_checkbox_' . $aRow[$hidden] . '" name="check_' . $aRow[$hidden] . '" value="' . $aRow[$hidden] . '" class="check" />
Exemple #2
0
function free_catgorized_save(){
	
	$sock=new sockets();
	$uuid=base64_decode($sock->getFrameWork("cmd.php?system-unique-id=yes"));
	
	if(!preg_match_all("#http.*?:\/\/(.+?)[\/\s]+#",$_POST["textToParseCats"]."\n",$re)){echo "No webistes\n";}
	
		while (list ($num, $www) = each ($re[1]) ){
			$www=strtolower($www);
			$www=replace_accents($www);
			if(preg_match("#^www\.(.+?)$#i",$www,$ri)){$www=$ri[1];}
			
			$sites[$www]=$www;
		}
		
	
	$q=new mysql();
	$q->CheckTable_dansguardian();
	
	if(count($sites)==0){echo "NO websites\n";return;}
	$category=$_POST["category"];
	echo "analyze ".count($sites)." websites into $category\n";
	while (list ($num, $www) = each ($sites) ){
		$md5=md5($www.$category);
		$sql="SELECT zmd5 FROM dansguardian_community_categories WHERE pattern='$www' AND category='$category'";
		$ligne=@mysql_fetch_array($q->QUERY_SQL($sql,"artica_backup"));
		$sql_add="INSERT INTO dansguardian_community_categories (zmd5,zDate,category,pattern,uuid) VALUES('$md5',NOW(),'$category','$www','$uuid')";
		if($ligne["zmd5"]<>null){continue;}		
		echo "Added $www\n";
		$q->QUERY_SQL($sql_add,"artica_backup");
		if(!$q->ok){echo $q->mysql_error;return;}
		$cats=GetCategory($www);
		$sql="UPDATE dansguardian_sitesinfos SET category='$cats', dbpath='$cats' WHERE website='$www'";
		writelogs("$sql",__FUNCTION__,__FILE__,__LINE__);
		$q->QUERY_SQL($sql,"artica_backup");
		if(!$q->ok){echo $q->mysql_error."\n";echo $sql;}
		$sql="UPDATE squid_events_sites SET category='$cats' WHERE website='$www'";
		writelogs("$sql",__FUNCTION__,__FILE__,__LINE__);
		$q->QUERY_SQL($sql,"artica_events");
		if(!$q->ok){echo $q->mysql_error."\n";echo $sql;}
		
	}		
		
	$sock=new sockets();
	$sock->getFrameWork("cmd.php?export-community-categories=yes");
	
	
}
function GetPage($res = '')
{
    $image = $res[image];
    if (empty($image)) {
        $image = '0.jpg';
    }
    $data = '
	<!-- jQuery Dialog -->
    <div id="add-edit-prod-form-field" title="შემადგენლობა">
    	<!-- aJax -->
	</div>
	<div id="dialog-form">
		<fieldset style="width: 300px; float: left;">
	    	<legend>ძირითადი ინფორმაცია</legend>

	    	<table class="dialog-form-table">
	    		<tr>
					<td style="width: 170px;"><label for="code">კოდი</label></td>
					<td>
						<input type="text" id="code" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['code'] . '" />
					</td>
				</tr>								
				<tr>
					<td style="width: 170px;"><label for="name">დასახელება</label></td>
					<td>
						<input type="text" id="name" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['name'] . '" />
					</td>
				</tr>

																
				<tr>
					<td style="width: 170px;"><label for="category">კატეგორია</label></td>
					<td>
						<select id="category" class="idls">' . GetCategory($res[pos_menu_category]) . '</select>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="unit">ზომის ერთეული</label></td>
					<td>
						<select id="unit" class="idls num" style = " width: 165px !important;">' . GetSize($res[unit]) . '</select>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="unit">შენიშვნა</label></td>
					<td>
						<textarea id="comment" class="idle large" cols="30" rows="1" style="width:159px !important; height:50px !important;">' . $res['comment'] . '</textarea>
					</td>
				</tr>
			</table>
        </fieldset>
							
		<fieldset style="width: 300px; float: left; margin-left:6px !important; height:190px !important;">
	    	<legend>პროდუქტის სურათი</legend>
			
	    	<table class="dialog-form-table" width="100%">
	    		<tr>
					<td id="img_colum" colspan="2">
						<img id="upload_img" src="media/uploads/images/production/' . $image . '">
					</td>
				</tr>
				<tr><!-- Upload Image -->
					<td id="act">
						<span>
							<a href="#" id="view_image" class="complate" style="float:left; margin-left:14px;">View</a> <p style="float:left; margin-left:5px;">|</p> <a href="#" id="delete_image" class="delete" style="float:left; margin-left:5px;">Delete</a>
						</span>
					</td>
					<td>
						<div class="file-uploader">
							<input id="choose_file" type="file" name="choose_file" class="input" style="display: none;">
							<button id="choose_button" class="center">აირჩიეთ ფაილი</button>
						</div>
					</td>
				</tr>
			</table>
        </fieldset>	

		
								
		<fieldset>
	    	<legend>პროდუქტი</legend>

		    <div class="inner-table">
			    <div id="dt_example" class="ex_highlight_row">
			        <div id="container" class="overhead_container">
			        	<div id="button_area">
			        		<button id="add_button_prod">დამატება</button><button id="delete_button_prod">წაშლა</button>
			        	</div>
			            <div id="dynamic">
			                <table class="display" id="prod_list">
			                    <thead>
			                        <tr id="datatable_header">				                        
			                            <th>ID</th>
			                            <th style="width : 100%">პროდუქტი</th>
			                            <th class="min" style="width:90px !important;">რაოდენობა</th>
										<th class="min" style="width:100px !important;">თვითღირებ.</th>
										<th class="min" style="width:90px !important;">ნამ. ფასი</th>
			                            <th class="check">#</th>
			                        </tr>
			                    </thead>
			                    <thead>
			                        <tr class="search_header">				                        
			                            <th class="colum_hidden">
			                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" />
			                            </th>
			                            <th>
			                            	<input type="text" name="search_prod" value="ფილტრი" class="search_init" />
			                            </th>
			                            <th></th>
										<th></th>
										<th></th>
										<th>
											<input type="checkbox" name="check-all" id="check-all-prod" style="margin-left: 13px;">
										</th>
			                        </tr>
			                    </thead>
			                </table>
			            </div>
			        </div>
			    </div>
			</div>
		</fieldset>
								
			
								
								
		<!-- ID -->
		<input type="hidden" id="rec_id" value="' . $res['id'] . '" />
		<input type="hidden" id="local_rec_id"/>
    </div>    
    ';
    return $data;
}
      <li> <em class="w80">邀请人ID</em>
        <input id="invite" name="invite" value="0" class="input_ w100" type="text" />
        <div class="clear warning">填写<?php 
        echo $siteweb['siteName'];
        ?>
员工的推广数字ID ,并非QQ,可选填,方便专员审核。</div>
      </li>
     <li> <em class="w80">商品 ID</em>
        <input id="taobaoid" name="taobaoid" class="input_ w200" type="text" error="请输入商品ID!" reg="非空"/>
        <a id="search" class="button_y2" style="float: left;cursor: pointer;">一键获取</a> <span class="red">*</span>
        <div class="clear warning">填写商品宝贝ID,一键获取。(不可重复添加同一商品)</div>
      </li>
      <li> <em class="w80">商品分类</em>
        <select style="height: 28px; line-height: 28px;" id="goodstype" name="goodstype">
          <?php 
        foreach (GetCategory() as $Category) {
            ?>
          <option value="<?php 
            echo $Category['id'];
            ?>
"><?php 
            echo $Category['name'];
            ?>
</option>
          <?php 
        }
        ?>
        </select>
        <?php 
        if ($acid == 2) {
            echo '<div style="display:none"> ';
function fillSitesInfos(){
	$sql="SELECT website FROM dansguardian_sitesinfos WHERE LENGTH(dbpath)=0";
	$q=new mysql();
	$results=$q->QUERY_SQL($sql,"artica_backup");	
	while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
		$ligne["website"]=trim($ligne["website"]);
		if($ligne["website"]==null){continue;}
		
		$cat=trim(GetCategory($ligne["website"]));
		if($GLOBALS["VERBOSE"]){echo "{$ligne["website"]} = \"$cat\"\n";}
		if($cat<>null){
			echo "Starting......: Artica database update {$ligne["website"]} to $cat\n";
			$sql="UPDATE dansguardian_sitesinfos SET dbpath='$cat' WHERE website='{$ligne["website"]}'";
			$q->QUERY_SQL($sql,"artica_backup");
		}
	}
	
	
}
function GetPage($res = '')
{
    $image = $res[image];
    if (empty($image)) {
        $image = '0.jpg';
    }
    $data = '		
	<div id="dialog-form">
		<fieldset style="width: 350px; float: left;">
	    	<legend>ძირითადი ინფორმაცია</legend>

	    	<table class="dialog-form-table">
	    		<tr>
					<td style="width: 170px;"><label for="code">კოდი</label></td>
					<td>
						<input type="text" id="code" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['code'] . '" />
					</td>
				</tr>								
				<tr>
					<td style="width: 170px;"><label for="name">დასახელება</label></td>
					<td>
						<input type="text" id="name" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['name'] . '" />
					</td>
				</tr>

																
				<tr>
					<td style="width: 170px;"><label for="category">კატეგორია</label></td>
					<td>
						<select id="category" class="idls">' . GetCategory($res[category]) . '</select>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="unit">ზომის ერთეული</label></td>
					<td>
						<select id="unit" class="idls num" style="width: 165px !important;">' . GetSize($res[unit]) . '</select>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="unit">მინ. რაოდენობა</label></td>
					<td>
						<input type="text" id="min" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['min_amount'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="unit">შენიშვნა</label></td>
					<td>
						<textarea id="comment" class="idle large" cols="30" rows="1" style="width:159px !important; height:50px !important;">' . $res['comment'] . '</textarea>
					</td>
				</tr>
			</table>
        </fieldset>
								
 	    <fieldset style="width: 350px;">
	    	<legend>პროდუქტის სურათი</legend>
			
	    	<table class="dialog-form-table" width="100%">
	    		<tr>
					<td id="img_colum" colspan="2">
						<img id="upload_img" src="media/uploads/images/production/' . $image . '">
					</td>
				</tr>
				<tr><!-- Upload Image -->
					<td id="act">
						<span>
							<a href="#" id="view_image" class="complate">View</a> | <a href="#" id="delete_image" class="delete">Delete</a>
						</span>
					</td>
					<td>
						<div class="file-uploader">
							<input id="choose_file" type="file" name="choose_file" class="input" style="display: none;">
							<button id="choose_button" class="center">აირჩიეთ ფაილი</button>
						</div>
					</td>
				</tr>
			</table>
        </fieldset>
		<div class="clear"></div>
								
								
			
												
		<!-- ID -->
		<input type="hidden" id="prod_id" value="' . $res['id'] . '" />
    </div>
    
    ';
    return $data;
}
function BuildEmptyCategories()
{
    $unix = new unix();
    $table = "Kav4Proxy_" . date("Ym");
    $sql = "SELECT sitename FROM {$table} WHERE LENGTH( category ) = 0 GROUP BY sitename";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$q->mysql_error}\n";
            return;
        }
        $unix->send_email_events("Kav4Proxy:[statistics] MySQL statistics error", "{$q->mysql_error}\n{$sql}\n", "proxy");
        return;
    }
    $t1 = time();
    $count = mysql_num_rows($results);
    $c = 0;
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $sitename = $ligne["sitename"];
        $cat = GetCategory($sitename);
        if ($cat != null) {
            $cat = str_replace("forum,forums", "forums", $cat);
            $sql = "UPDATE `{$table}` SET `category`='{$cat}' WHERE `sitename`='{$sitename}'";
            $q->QUERY_SQL($sql, "artica_events");
            if (!$q->ok) {
                $unix->send_email_events("Kav4Proxy:[statistics] MySQL statistics error ", "Errors: {$sql}\n{$q->mysql_error}\nTable {$table}, database artica_events", "proxy");
                return;
            }
            $q->QUERY_SQL("UPDATE `kav4proxyDays` SET `category`='{$cat}' WHERE `websites`='{$sitename}'", "artica_events");
            $q->QUERY_SQL("UPDATE `kav4proxyVirus` SET `category`='{$cat}' WHERE `sitename`='{$sitename}'", "artica_events");
            $c++;
        }
    }
    if ($c > 0) {
        $distanceOfTimeInWords = $unix->distanceOfTimeInWords($t1, time());
        $unix->send_email_events("Kav4Proxy:[statistics] MySQL statistics {$c}/{$count} categorized for {$table} table", "took {$distanceOfTimeInWords}", "proxy");
    }
}
<?php

include_once dirname(__FILE__) . '/ressources/class.templates.inc';
include_once dirname(__FILE__) . '/ressources/class.ldap.inc';
include_once dirname(__FILE__) . '/ressources/class.users.menus.inc';
include_once dirname(__FILE__) . '/ressources/class.artica.inc';
include_once dirname(__FILE__) . '/ressources/class.rtmm.tools.inc';
include_once dirname(__FILE__) . '/ressources/class.squid.inc';
include_once dirname(__FILE__) . '/ressources/class.dansguardian.inc';
include_once dirname(__FILE__) . '/ressources/class.ccurl.inc';
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . '/framework/frame.class.inc';
include_once dirname(__FILE__) . "/ressources/class.categorize.externals.inc";
if ($argv[1] = "--scan") {
    GetCategory($argv[2], $argv[3]);
    exit;
}
$array["casinos"] = "gamble";
$array["chaines-tv-internet"] = "webtv";
$array["telecharger-films"] = "movies";
$array["arnaque-escroquerie-par-email"] = "mailing";
$array["escroquerie-faux-anti-virus"] = "malware";
$array["tabac"] = "tobacco";
$array["contrefacon"] = "suspicious";
function GetCategory($source, $dest)
{
    for ($i = 1; $i < 13; $i++) {
        echo "Checking page number {$i}\n";
        $curl = new ccurl("http://cacaweb.com/category/{$source}/page/{$i}");
        $curl->NoHTTP_POST = true;
        $curl->UserAgent = "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0";
function GetCategory($uri)
{
    $CATZ["business"] = "industry";
    $CATZ["advertising"] = "publicite";
    $CATZ["search engines and portals"] = "searchengines";
    $CATZ["unrated"] = "";
    $CATZ["global"] = "";
    $CATZ["finance"] = "financial";
    $CATZ["news and media"] = "news";
    $CATZ["pornography"] = "p**n";
    $CATZ["education"] = "recreation/schools";
    $CATZ["personal websites and blogs"] = "blog";
    $CATZ["shopping and auction"] = "shopping";
    $CATZ["sports"] = "recreation/sports";
    $CATZ["real estate"] = "finance/realestate";
    $CATZ["reference"] = "dictionaries";
    $CATZ["information technology"] = "science/computing";
    $CATZ["restaurant and dining"] = "recreation/nightout";
    $CATZ["weapons"] = "weapons";
    $CATZ["personal vehicles"] = "automobile/cars";
    $CATZ["health and wellness"] = "health";
    $CATZ["travel"] = "recreation/travel";
    $CATZ["lingerie and swimsuit"] = "sex/lingerie";
    $CATZ["freeware and software downloads"] = "downloads";
    $CATZ["advocacy organizations"] = "justice";
    $CATZ["entertainment"] = "hobby/other";
    $CATZ["finance and banking"] = "finance/banking";
    $CATZ["content servers"] = "science/computing";
    $CATZ["web hosting"] = "isp";
    $CATZ["arts and culture"] = "hobby/arts";
    $CATZ["newsgroups and message boards"] = "forums";
    $CATZ["society and lifestyles"] = "society";
    $CATZ["malicious websites"] = "malware";
    $CATZ["meaningless content"] = "society";
    $CATZ["government and legal organizations"] = "governments";
    $CATZ["general organizations"] = "associations";
    $CATZ["social networking"] = "socialnet";
    $CATZ["alcohol"] = "alcohol";
    $CATZ["job search"] = "jobsearch";
    $CATZ["games"] = "games";
    $CATZ["illegal or unethical"] = "suspicious";
    $CATZ["web-based applications"] = "webapps";
    $CATZ["web-based email"] = "webmail";
    $CATZ["domain parking"] = "reaffected";
    $CATZ["gambling"] = "gamble";
    $CATZ["dynamic content"] = "redirector";
    $CATZ["other adult materials"] = "mixed/adult";
    $CATZ["proxy avoidance"] = "proxy";
    $CATZ["armed forces"] = "weapons";
    $CATZ["secure websites"] = "sslsites";
    $CATZ["file sharing and storage"] = "filehosting";
    $CATZ["streaming media and download"] = "audio-video";
    $CATZ["sex education"] = "sexual_education";
    $CATZ["abortion"] = "abortion";
    $CATZ["nudity and risque"] = "mixed/adult";
    $CATZ["dating"] = "dating";
    $CATZ["marijuana"] = "drugs";
    $CATZ["tobacco"] = "tobacco";
    $CATZ["explicit violence"] = "violence";
    $CATZ["internet radio and tv"] = "webradio";
    $CATZ["folklore"] = "";
    $CATZ["global religion"] = "religion";
    $CATZ["political organizations"] = "politic";
    $CATZ["child education"] = "children";
    $CATZ["brokerage and trading"] = "stockexchange";
    $CATZ["digital postcards"] = "gifts";
    $CATZ["instant messaging"] = "chat";
    $CATZ["hacking"] = "hacking";
    $CATZ["internet telephony"] = "webphone";
    $CATZ["phishing"] = "phishing";
    $CATZ["spam urls"] = "mailing";
    $CATZ["medicine"] = "medical";
    $CATZ["sports hunting and war games"] = "violence";
    $curl = new ccurl($uri);
    $curl->noproxyload = true;
    $curl->NoHTTP_POST = true;
    $curl->ArticaProxyServerEnabled = "no";
    $curl->interface = "10.32.0.36";
    $curl->Timeout = 5;
    if (!$curl->get()) {
        if (preg_match("#Category:\\s+([A-Za-z\\_\\-0-9\\s]+)#is", $curl->orginal_data, $re)) {
            $category = trim(strtolower($re[1]));
            if ($category == "unrated") {
                return null;
            }
            $newcategory = $CATZ[$category];
            if ($newcategory == null) {
                echo "{$uri} \"{$category}\" not translated\n";
                return 1;
            }
            return $newcategory;
        }
        echo $curl->orginal_data;
    }
    if (isset($curl->CURL_ALL_INFOS["redirect_url"])) {
        $curl->CURL_ALL_INFOS["redirect_url"] = trim($curl->CURL_ALL_INFOS["redirect_url"]);
        if ($curl->CURL_ALL_INFOS["redirect_url"] != null) {
            $GLOBALS["COUNTTR"]++;
            if ($GLOBALS["COUNTTR"] < 4) {
                return GetCategory($curl->CURL_ALL_INFOS["redirect_url"]);
            }
        }
    }
    return null;
}
Exemple #10
0
function save_category(){
	$www=trim(strtolower(base64_decode($_GET["website"])));
	if(preg_match("#^www\.(.+?)$#i",$www,$re)){$www=$re[1];}
	$category=$_GET["category"];
	$md5=md5($www.$category);
	$sock=new sockets();
	$uuid=base64_decode($sock->getFrameWork("cmd.php?system-unique-id=yes"));
	$enabled=$_GET["enabled"];
	$sql="SELECT zmd5 FROM dansguardian_community_categories WHERE pattern='$www' AND category='$category'";
	
	
	
	$q=new mysql();
	$q->CheckTable_dansguardian();
	$ligne=@mysql_fetch_array($q->QUERY_SQL($sql,"artica_backup"));
	$sql_add="INSERT INTO dansguardian_community_categories (zmd5,zDate,category,pattern,uuid) VALUES('$md5',NOW(),'$category','$www','$uuid')";
	$sql_edit="UPDATE dansguardian_community_categories SET enabled='$enabled' WHERE category='$category' AND pattern='$www'";
	
	writelogs("$www/$category = {$ligne["zmd5"]}",__FUNCTION__,__FILE__,__LINE__);
	
	if($ligne["zmd5"]==null){$q->QUERY_SQL($sql_add,"artica_backup");}
	else{
		writelogs("$sql_edit",__FUNCTION__,__FILE__,__LINE__);
		$q->QUERY_SQL($sql_edit,"artica_backup");
	}
	if(!$q->ok){
		echo $q->mysql_error;
		return;
	}
	
	$cats=GetCategory($www);
	
	$sql="UPDATE dansguardian_sitesinfos SET category='$cats', dbpath='$cats' WHERE website='$www'";
	writelogs("$sql",__FUNCTION__,__FILE__,__LINE__);
	$q->QUERY_SQL($sql,"artica_backup");
	if(!$q->ok){
		echo $q->mysql_error."\n";
		echo $sql;
		
	}

	
	$sql="UPDATE squid_events_sites SET category='$cats' WHERE website='$www'";
	writelogs("$sql",__FUNCTION__,__FILE__,__LINE__);
	$q->QUERY_SQL($sql,"artica_events");
	if(!$q->ok){
		echo $q->mysql_error."\n";
		echo $sql;
		
	}	
	
	
	
	$sock=new sockets();
	$sock->getFrameWork("cmd.php?export-community-categories=yes");
	
}
Exemple #11
0
function FillCategories(){
	$unix=new unix();
	$cachetime="/etc/artica/postfix/pids/".basename(__FILE__).".".__FUNCTION__.".time";
	if($cachetime>2880){
		$sql="SELECT websites FROM `squid_events_sites_day` GROUP BY websites";
	}else{ 
		$sql="SELECT websites FROM `squid_events_sites_day` WHERE LENGTH( category ) =0 GROUP BY websites";
	}
	$q=new mysql();
	$results=$q->QUERY_SQL($sql,"artica_events");
	if(!$q->ok){
		if($GLOBALS["VERBOSE"]){echo $q->mysql_error."\n";}
		$unix->send_email_events("Error: Web Proxy Category statistics ","Errors: $sql\n$q->mysql_error","proxy");
		return;
	}
	
	@unlink($cachetime);
	@file_put_contents($cachetime,"#");

	
	while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
		$website=$ligne["websites"];
		$cat=GetCategory($website);
		if($cat<>null){
			$sql="UPDATE `squid_events_sites_day` SET `category`='$cat' WHERE `websites`='$website'";
			$q->QUERY_SQL($sql,"artica_events");
			if(!$q->ok){
				$unix->send_email_events("Error: Web Proxy Category statistics ","Errors: $sql\n$q->mysql_error\nTable squid_events_sites_day, database artica_events","proxy");
				return;
			}
			$sql="UPDATE `squid_events_clients_sites` SET `category`='$cat' WHERE `websites`='$website'";
			$q->QUERY_SQL($sql,"artica_events");
			if(!$q->ok){
				$unix->send_email_events("Error: Web Proxy Category statistics ","Errors: $sql\n$q->mysql_error\nTable squid_events_clients_sites, database artica_events","proxy");
				return;
			}			
			
			
		}
	}	
	
	
}