Esempio n. 1
0
 function Extended_Implode($array, $separator = ', ', $last_separator = ' and ')
 {
     $array = (array) $array;
     if (Count($array) == 0) {
         return '';
     }
     if (Count($array) == 1) {
         return $array[0];
     }
     $last_item = Array_pop($array);
     $result = Implode($array, $separator) . $last_separator . $last_item;
     return $result;
 }
Esempio n. 2
0
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;
}