function ggtracker() { rem($ref, $_ENV['yt']['ref'], refe); #.refe Car déjà enregistré $files = "ico|eot|ttf|js|css|htc|woff|swf|xml|gif|png|bmp|flv|mp(3|4)|exe|jpe?g|aspx?"; #bad extensions $bp = "~\\?(jsr?|css|rss)|Final|visuall|zsimu|contact2?\\.php|suivi|s74.fr|4Test|(zsimu|2001|admin|intranet|sql)/|z/\\!|/!|/y/|\\.({$files})\$~i"; #bad url $bR = "~(a74|xzxzx|dc10)\\.fr|frontaliers\\.info|yahooapi|url=|\\.(s?html|{$files})\$~i"; #bad referer : can't be the referer,ex:referal spam #shall be recorded on first step ! if (stripos(' ' . $ref . refe, '<a href')) { Block(array('badref', $ref . refe)); } elseif (h == 'cli') { $x = 'cli'; } elseif (bots) { $x = 'bots'; } elseif (!$GLOBALS['tracker']) { $x = '!tracker'; } elseif ($GLOBALS['notracker']) { $x = 'notracker'; } elseif ($_ENV['yt']['lw'] + 600 > now) { $x = 'lw<600'; } elseif (Preg_Match('~SID|css|js|jsr~is', q)) { $x = 'badq'; } elseif (Preg_Match("~\\.({$files})\$~is", u)) { $x = 'badfiletype'; } elseif (Preg_Match("~yandsearch|saihm|seoheap|internesdedijon|(a74|xzxzxz)\\.fr~is", REFE . Q . $ref)) { $x = 'badref'; } elseif (Preg_Match("~(Tag|2|zsimu|qform|contact2?)\\.php|Final|dev3|/(3p|mut|!r|\\?|sql|2001|intranet)~is", u)) { $x = 'badurl'; } elseif (Preg_Match($bp, $ref, $t)) { $x = 'ref:badpat(u)'; } elseif (Preg_Match($bp, u, $t2)) { $x = 'url:badpat'; } elseif (Preg_Match($bR, refe . $ref, $t3)) { $x = 'ref:badpat(R)'; } elseif (preg_match("~\\.(php|s?html?)\$~", u)) { $x = 11; } elseif (strpos(substr($v, -5), '.') > -1) { $x = 'is not php or shtml : other filetype'; } else { $x = 12; } #unknown if (!is_numeric($x)) { null; } else { G2('k1'); #si le fichier existe déjà sur le serveur, cette valeur est récupérée, puis inserée de nouveau pour marquer l'autre site avec le meme mot clés #$y=Preg_replace('`&(babsrc|affid|mntrid|channel|client|clientcop|source|gs_rfai|ei|btng|spell|resnum|sourceid|channel|filetype|vertical|_iceurlflag|_iceurl)=([^&]+)`is','',$y); $y = str_replace(array('search/z/results/', '/fr/results/index/q/', 'search/', 'search?w=tot', 'as_q=', 'custom&q=', '&aqa=', '&aqp=', '/web/', 'rdata=', 'lts/&q='), '&q=', $ref); $y = str_replace(array('search/srpcache', 'linkdoctor', 'toggle=1', 'sa=n', 'ei=', 'prmd=mc', 'hl=fr', 'rls=', 'org.mozilla:fr', ':official', 'firefox-a', 'http://', 'www.', 'fr.', 'search.', 'aq=', 'oq=', 'aqi=', 'fkt=', 'fsdt=', 'fr=yfp-t-703', 'meta=lr', 'source=hp', 'aql=', 'hs=', 'tbo=s', 'rlz=', 'searchal', 'utf-8', 'ie=', 'oe=', 'sourceid=', 'nabclient', 'gfns=', '/bottomnavigation', '/relevance', '%22', 'recherche google', 'ved=', 'ct=', 'sa=x', 'oi=spell', 'rlz=', 'hl=fr', 'oq=', 'linkdoctor', 'safari', 'redir_esc=', 'ie=', 'oe=', 'utf-8', 'aq=', 'rls=', 'org.mozilla:', 'fr:official', 'meta=', 'gs_rfai=', 'aqi=', 'ql=', 'navclient', 'usg=', 'vc=', 'safe=', 'active', 'com.microsoft', 'en-gb', 'searchbox', 'ecofree.org/search.php', 'pid=', 'search.daum.net', 'results&', 'itag=ody', 'search&', '&hl=fr', 'topnavigation/', 'relevance/', 'iq=true/', 'zoom=off/', '=7', '&oq=', '&aq=', '&cx=', 'partner-', 'mb-', 'pub-'), '&', $y); $y = trim(Preg_replace("~[&]{2,}~", '&', $y), ' &'); $mots = kwd($y); #travaux de nettoyage du referrer =) if ($mots && !strpos($mots, 'provided') && !in_Array($mots, array('', ':'))) { $mots = Tridecoder($mots); $mots = Preg_replace("~((google|yahoo|bing|yandex|gooofullcom|vizzeo|.?chiadah|find\\.eu|ke\\.voila|voila|seexie|askpeter|iadah|yougoo|yhs4|ecosia)\\.|search;|cx=|goooful|(\\.fr)?iadah\\.com).*|\\.it\$~is", '', $mots); $trop = explode(',', "_,</a>,< a>,<a href=,refineobj:video,google.ca,google.ci,google.co.uk ,url ,google.fr ,google.com ,search ,hl=en,sa=t,spider.htm"); $mots = trim(str_replace($trop, '', $mots)); #synchronisation des bibliothècas,maintenance if (preg_match("~^.(ttp&%2f%2f|ttp:)~is", $mots) or strlen($mots) < 3) { Null; } elseif ($_ENV['yt']['mots'] == $mots || $_ENV['yt']['fmt']['kw'] + 600 > NOW) { null; } else { #Nouveau mot clé if (preg_match("~q=([^&]+)~is", $mots, $t)) { $mots = $t[1]; } if (Preg_Match_ALL("~" . BKW . "~i", $mots, $t)) { Block($t[0], $mots); } #blockage de l'IP et throw 404 if (Preg_Match("~bestof~is", U)) { $mots = ''; } #cancel if ($mots) { #if(!$_ENV['yt']){$_ENV['yt']=Array();DBM('!yt',"<pre>".STARTER."-$mots</pre>",'a6');}$i=$_ENV['yt']; $yt2 = array('lw' => NOW, 'date' => date("Y/m/d H:i:s"), 'mots' => $mots, array('fmt' => array('kw' => NOW))); if ($_ENV['yt']['mots']) { $yt2['mots-1'] = $_ENV['yt']['mots']; } #DBM('ggt',"<pre>$mots,".print_r($_ENV['yt'],1).'</pre>','gg9'); if (Preg_Match("~gclid=|aclk\\?~is", $_ENV['yt']['ref'])) { $yt2['adwords'] = $mots; } elseif (0) { #insertions sql //todo:file_append puis écriture en lots $x2 = sql5("UPDATE CSF set site='" . H . "',hits=hits+1,ip='" . IP . "',time=" . NOW . ",date=now(),Ref=\"{$ref}\" {$s1} where url=\"" . SU . "\" and keyword=\"{$mots}\" order by id ASC limit 1"); if ($x2 < 1) { sql5("INSERT INTO CSF(ip,Ref,site,keyword,url,position,time,date)VALUES('" . IP . "',\"{$ref}\",'" . H . "',\"{$mots}\",\"" . SU . "\",'{$pos}'," . NOW . ",NOW())"); } #INSERT INTO CSF SET key = 'key', generation = 'generation' ON DUPLICATE KEY UPDATE key = 'key', generation = (generation + 1); } #$_SESSION['st1']=$magic;#$_SESSION['mots']=$mots; $magic = "{$mots};" . $_ENV['yt']['dlp'] . ";" . $_ENV['yt']['ref']; setcookie('kw', $mots, 1484045758); setcookie('dlp', $magic, 1484045758); } } if (is_array($yt2)) { $_ENV['yt'] = Array_merge($_ENV['yt'], $yt2); FAP(IPF, $_ENV['yt']); } redef('motcle', $mots); } } }
function Starter() { if (us == 'ben' || in_array(h, ['cron', 'cli'])) { return; } e(',starter'); gt('starter'); $ip = IP; $ref = cleanref(REFE); #pour le cron if (!STARTER or Preg_Match("~url.data:|image/png;|base64|/!|2001/|admin|intranet|zsimu|(bg|Tag)\\.php|(jsr?|css|jpg|png|ico|gif|eot|htc)\$|\\.(swf|js|css|jpg|png|ico|gif|eot|htc)~is", U . REFE, $t) && !stripos(U . REFE, "submit")) { e(',starter:return:quick'); return array('host' => RH, 'ip' => IP, 'dlp' => SU, 'u' => SU, 'r' => $ref, 'ref' => $ref); } #ne rien logger pour ces cas là .. retour simple de données if (is_file(IPF)) { e(',isfile:ipf'); $t = FGC(IPF); G2('ipf', 'Read'); $t['ip'] = IP; if (J9) { $t['admlog']++; } foreach ($t as $k => $v) { if (is_numeric($k) or $k == 'SESSION') { unset($t[$k]); } } #suppresion des clés numériques issues d'un bug sur FAP #if(in_Array(trim($t['mots'],'() '),Array('','not provided'))){unset($t['mots']);$t['motseffacés']=1;} if (Preg_Match("~[A-Za-z]~is", $t['host'])) { null; } elseif (RH != IP && RH) { $t['host'] = RH; GT('host=rh'); } #correction #else{$x['host']=gethostbyaddr($ip);GT('host=reverse');}#correction = take to much time if (!is_numeric($t['hits'])) { $t['hits'] = 1; } else { $t['hits'] = $t['hits'] + 1; } #c,d,b,p } #New data here :) #need keyword on js,php,rewriting,#remplacer par des clés nouvelles if (!strpos(REFE, H) && strlen($ref) > 5 && !Preg_Match('~' . HOMESITE . '~', REFE) && $t['fmt']['ref'] + 300 < now) { $t['ref'] = $ref; $t['fmt']['ref'] = now; } #lastref #if(SU!=refe&&strlen($ref)>5&&$t['fmt']['re']+1500<now){$t['fmt']['re']=now;$t['ref']=$ref;}#rem:internal referers if (SU != refe && !Preg("~/([!|\\?]|cont)~", SU) && $t['fmt']['dlp'] + 1500 < now) { $t['fmt']['dlp'] = now; $t['dlp'] = SU; } #dlp #DLP is set with a new keyword only !!!! if ($_COOKIE['__utmz'] && $t['fmt']['kw'] + 3600 < NOW) { #Si cookie sur le domaine de moins d'une heure, on récupère ce mot clé #Si mot clé défini par ggtracker<>$yt[mots], le refe!=$yt[dlp] if (!strpos($_COOKIE['__utmz'], 'not provided')) { if (Preg_Match("~utmctr=([^;|]+)~", $_COOKIE['__utmz'], $z)) { G2('utmz', '>keyw'); if (trim($z[1])) { $t['mots'] = $z[1]; $t['fmt']['kw'] = now; } } } GT('s2'); #30 } #$f5=TMP."hosts/$ip";#Touch($f5,fmkt($f5)+1);GT('s1'); GT('s4'); if (!Preg_Match("~/z/|/\\?~", SU) && Preg_Match('~gclid|aclk~i', Q . REFE)) { $t['aclk']++; $t['gclid']++; Fap(LOGS . 'adwords.db', now, array(IP, u, $ref)); gt('s5'); } if (Preg_Match("~googleads|doubleclick~is", REFE)) { #ref Preg_Match_ALL("~&(url)=([^&]+)~is", refe, $y); Array_shift($y); #|okw|kw[0-9] foreach ($y[0] as $n => $k) { unset($y[0][$n]); $y[0][$k] = urldecode($y[1][$n]); } Array_pop($y); $y = $y[0]; Fap(LOGS . 'adwords.db', 't' . now, $y); $t['ads'] = $y; } #gclid#si cookie utmz, alors .. fills the keywords again #if($t){foreach($t as $k=>$v)$x[$k]=$v;}FPC(ipf,$x,4);GT('fPcipf'); $x = RH; if (is_numeric(RH) || !RH) { $x = IP; } GT('host'); #$x=gethostbyaddr($ip);if(!$x) $t['ip'] = ip; $t['host'] = $x; $t['hits'] = 1; FAP(IPF, $t); GT('fPcipf2'); return $t; }