", "\n", "You can safely close this window.", "" ; } #------------------------------ function saveViewTimeData(&$cfg, &$pars){ DBType($cfg['DbType']); $dbh = DBConnect($cfg['DbHost'], $cfg['DbPort'], $cfg['DbUser'], $cfg['DbPass'], true) ; if (!$dbh) return ; if(! DBSelect($dbh, $cfg['DbName'], true) ) return ; $cfg['dbh'] = $dbh ; if (isset($pars['transport']) && $pars['transport'] == 'img') { saveViewFromImg($cfg, $pars) ; }else{ saveView($cfg, $pars) ; } DBClose($dbh) ; } #------------------------------ function saveViewFromImg (&$cfg, &$pars) { # wrapper for saveView() # save click received from cookie if (!empty($_COOKIE['asRep_click'])) { setcookie ('asRep_click', '', 0, '/') ; } $pars['p'] = '' ; $pars['asn'] = 0 ; $pars['wsn'] = 0 ; $pars['ref'] = "Unknown (IMG tracking, JavaScript is disabled)" ; $pars['nav'] = 'other' ; $uagent = '' ; if (isset($_SERVER['HTTP_USER_AGENT'])) { $uagent = $_SERVER['HTTP_USER_AGENT'] ; if (preg_match('/MSIE/', $uagent) && !preg_match('/opera/i', $uagent)) $pars['nav'] = 'msie' ; elseif (preg_match('/gecko/i', $uagent)) $pars['nav'] = 'gecko' ; else $pars['nav'] = 'other' ; } $pars['tv'] = GMTime() ; $pars['id'] = FingerPrint(mt_rand(0,1024).VisIP().$pars['p'].$uagent, 1) ; saveView ($cfg, $pars) ; } #------------------------------ function saveView (&$cfg, &$pars) { # save click received from cookie } $pars['p'] = empty($pars['p']) ? (empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']) : urldecode($pars['p']) ; if (empty($pars['p'])) return ; $pars['ip'] = 0+IPstr2num(VisIP()) ; # save new view record require_once("recsave.php") ; if (empty($cfg['inBuffer'])){ saveViewRecord($cfg, $pars) ; }else{ saveView2Buffer($cfg, $pars) ; } } #------------------------------ $pars = array() ; foreach ($pairs as $p) { list($k, $v) = explode("=", $p) ; $pars[$k] = urldecode($v) ; } saveClickTimeData2($cfg, $pars) ; } #------------------------------ function saveClickTimeData(&$cfg, &$pars){ DBType($cfg['DbType']); $dbh = DBConnect($cfg['DbHost'], $cfg['DbPort'], $cfg['DbUser'], $cfg['DbPass'], true) ; if (!$dbh) return ; if(! DBSelect($dbh, $cfg['DbName'], true) ) return ; $cfg['dbh'] = $dbh ; saveClickTimeData2($cfg, $pars) ; DBClose($dbh) ; } #------------------------------ function saveClickTimeData2(&$cfg, &$pars){ if (isset($pars['nav']) && isset($pars['asn']) && isset($pars['wsn'])) { # view record # Views are banned. We must save a view record first. $vpars = $pars ; $vpars['rep'] = 'v' ; saveView($cfg, $vpars) ; } if ($pars['rep'] == 'c'){ saveClick($cfg, $pars) ; }elseif ($pars['rep'] == 's'){ saveSubmit($cfg, $pars) ; }elseif ($pars['rep'] == 'alt'){ saveAlternateAds($cfg, $pars) ; } } #------------------------------ function saveClick (&$cfg, &$pars){ require_once("recsave.php") ; if (empty($cfg['inBuffer'])){ saveClickRecord($cfg, $pars) ; }else{ saveClick2Buffer($cfg, $pars) ; } } #------------------------------ function saveSubmit (&$cfg, &$pars){ require_once("recsave.php") ; if (empty($cfg['inBuffer'])){ saveSubmitRecord($cfg, $pars) ; }else{ saveSubmit2Buffer($cfg, $pars) ; } } #------------------------------ function saveAlternateAds (&$cfg, &$pars){ require_once("recsave.php") ; if (empty($cfg['inBuffer'])){ saveAltAdRecord($cfg, $pars) ; }else{ saveAltAd2Buffer($cfg, $pars) ; } } #################### JAVA SCRIPT ######################### function isTrackingBlocked(&$cfg, $vIP=NULL){ if (isset($_COOKIE['asRepBlockTracking']) && $_COOKIE['asRepBlockTracking']) { # block tracking setcookie ('asRepBlockTracking', '1', time()+180*24*60*60, $cfg['PathUrl']) ; return TRUE ; } if (!empty($cfg['blockedIps']) && count($cfg['blockedIps'])) { if (!$vIP) $vIP = 0+IPstr2num(VisIP()) ; foreach ($cfg['blockedIps'] as $iprange) { if ($vIP >= $iprange[0] && $vIP < ($iprange[0]+$iprange[1])) { return TRUE ; } } } return FALSE ; } #------------------------------ function jsIntro (&$cfg, &$pars) { $scope = isset($pars['scope']) ? $pars['scope'] : (isset($cfg['codeDefaultScope']) ? $cfg['codeDefaultScope'] : 'frame') ; header("Expires: ". HttpTimeStr(10*60)); header("Cache-Control: public, max-age=" . (10*60)); header("Content-Type: text/javascript"); if (isTrackingBlocked($cfg)) { echo " \n" ; return ; } ?> function asRep_nav(){ if(navigator.appName.toLowerCase()=="microsoft internet explorer"&&typeof(window.onbeforeunload)!='undefined')return 'msie'; if(navigator.userAgent.search(/gecko/i)>=0)return 'gecko'; return 'other'; } function asRep_testLateJS(){try{ var si=document.createElement('script'); si.language="javascript";si.type="text/javascript";si.text="var asRep_lateJS=1;"; document.getElementsByTagName('head')[0].appendChild(si); }catch(e){};} function asRep_workWindow(){ var ww=window; do{ if((!ww.parent)||ww.parent==ww)return ww; var accessUp=true;try{eval("ww.pa"+"rent.loca"+"tion.hr"+"ef");}catch(e){accessUp=false;} if(!accessUp)return ww; ww=ww.parent; }while(true); } var asRep_workWind=asRep_workWindow(); var asRep_workWind=window; if(!asRep_workWind.asRep_wasHere){ asRep_workWind.asRep_wasHere=true; var asRep_serverURL=""; var asRep_ViewTime=(new Date()).getTime(); asRep_testLateJS(); document.write("<"+"sc"+"ript language='javascript' type='text/javascript' src='"+ asRep_serverURL+"?rep=code&nav="+asRep_nav()+"&scope=&tmp="+asRep_ViewTime+"'>"); } function asRep_addEvent(obj,event,func,ecap){ var oe=null; if(obj.addEventListener)obj.addEventListener(event,func,ecap?true:false); else if(obj.attachEvent)obj.attachEvent("on"+event,func); else eval("oe=obj.on"+event+";obj.on"+event+"=func;"); return oe; } function asRep_InlineSend(jsok,url){ this.obj=null; this.type=null; this.sendTime=0; this.loaded=false; if(jsok&&window.asRep_lateJS&&!this.obj){ this.obj=document.createElement('script'); this.obj.language="javascript";this.obj.type="text/javascript"; document.getElementsByTagName('head')[0].appendChild(this.obj); this.type='s'; } if(window.Image&&!this.obj){ this.obj=new window.Image(); this.type='i'; } this.Send=function(url){ this.loaded=false; this.sendTime=(new Date()).getTime(); if(this.type=='i'){ this.obj.src=url+"&transport=i"; }else if(this.type=='s'){ this.obj.src=url+"&transport=s"; } } this.loadOK=function(ignoreimg){ if(this.type=='i')return ignoreimg?false:this.obj.complete; return false; } this.waitLoad=function(timeout,ignoreimg){ if(this.sendTime)while(this.sendTime+timeout>(new Date()).getTime() && !this.loadOK(ignoreimg)){}; } if(url)this.Send(url); } var asRep_RecViewTime=; var asRep_RecId=; var asRep_adBoxes=new Array(); var asRep_sBoxes=new Array(); var asRep_adBoxLut=new Array(); var asRep_ViewData=''; var asRep_viewILS=new asRep_InlineSend(true); var asRep_RoundTripDelay=(new Date()).getTime()-asRep_ViewTime; if(asRep_RoundTripDelay>5000)asRep_RoundTripDelay=5000; function asRep_gasAdBoxes(w,name){ var a=new Array(); if(w.document.all&&w.document.all(name)){ var b=w.document.all(name);if(b.length)for(var i=0;i-1 && forms[i].client) a[a.length]=forms[i]; return a; } function asRep_gasSearchBoxesAll(w,digdown){ var a=asRep_gasSearchBoxes(w); if(digdown && w.frames){ for(var i=0;i var isalt=asRep_altAd(asRep_adBoxes[i]); var isalt=0; data+="&aua"+i+"="+isalt; var qmi=asRep_adBoxes[i].src.indexOf('?'); if(qmi>=0){ var asd=asRep_adBoxes[i].src.substring(qmi+1,asRep_adBoxes[i].src.length).split('&'); for(var j=0;j0)asRep_adBoxLut[i]=3; else if(ii<3){asRep_adBoxLut[i]=ii++;} else asRep_adBoxLut[i]=-1; } } } data+="&fb"+i+"="+asRep_adBoxes[i].frameBorder; } } } data+="&wsn="+asRep_sBoxes.length ; for(var i=0;i data="rep=v&tv="+asRep_RecViewTime+"&id="+asRep_RecId+data; asRep_viewILS.Send(asRep_serverURL+"?"+data); } var asRep_repILS=new asRep_InlineSend(false); var asRep_repILSWUnloadOld=null; function asRep_repViaILS(url){ asRep_repILS.Send(url); } function asRep_eRepILSWUnload(e){ asRep_repILS.waitLoad(asRep_RoundTripDelay,); if(asRep_repILSWUnloadOld)asRep_repILSWUnloadOld(e); } function asRep_repViaPopWin(url){ var w=window.open(url,"asRep","SCROLLBARS=0,WIDTH=1,HEIGHT=1,RESIZABLE=0,MENUBAR=0,TOOLBAR=0,LOCATION=0,LEFT=5000,TOP=5000"); if(!w)return false; w.blur(); window.focus(); return true; } function asRep_repViaCookie(cval,cdur){ if(cdur>0){ var expires=new Date(); expires.setTime(expires.getTime()+cdur*1000); document.cookie="asRep_click="+cval+"; path=/; expires="+expires.toGMTString(); }else{ document.cookie="asRep_click="+cval+"; path=/"; } } function asRep_repAction(ct,data,showpopup){ var url=asRep_serverURL+"?"+data; data+=asRep_ViewData; var url=asRep_serverURL+"?"+data; if(showpopup)asRep_repViaPopWin(url); asRep_repViaILS(url); asRep_repViaCookie(data,); } function asRep_repSBoxSubmit(st,q,web,sbno){ var ts=Math.floor((st-asRep_ViewTime)/1000); if(ts==0)ts=1; var data="rep=s&tv="+asRep_RecViewTime+"&id="+asRep_RecId+"&ts="+ts+"&q="+escape(q)+"&web="+web+"&wsno="+sbno; asRep_repAction(st,data,1); } var asRep_SBoxSubmitOld=new Array(); function asRep_eSBoxSubmit(e,sbno){ var q=asRep_sBoxes[sbno].q?asRep_sBoxes[sbno].q.value:''; var web=1; if(asRep_sBoxes[sbno].sitesearch)for(var i=0;i function asRep_repAdBoxClick(ct,st,adboxno,cver){ var tc=Math.floor((ct-asRep_ViewTime)/1000); if(tc==0)tc=1; var data="rep=c&tv="+asRep_RecViewTime+"&id="+asRep_RecId+"&tc="+tc+"&st="+escape(st)+"&cau="+asRep_adBoxLut[adboxno]+"&cver="+cver; asRep_repAction(ct,data,cver); } var asRep_navVer=parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE")+4)); var asRep_tAdBoxNo=-1; var asRep_tAdBoxFocusTime=0; var asRep_tAdBoxStatus=""; function asRep_eAdBoxFocus(adboxno,w){ asRep_tAdBoxNo=adboxno; asRep_tAdBoxFocusTime=(new Date()).getTime(); var st=window.status; if(asRep_navVer>=7.0){ if(!st.length)st="Unknown (MSIE "+parseInt(asRep_navVer)+", status bar access is disabled)"; asRep_repAdBoxClick(asRep_tAdBoxFocusTime,st,asRep_tAdBoxNo,0); }else{ if(st.length && asRep_tAdBoxStatus!=st)asRep_repAdBoxClick(asRep_tAdBoxFocusTime,st,asRep_tAdBoxNo,0); else w.focus(); } asRep_tAdBoxStatus=st; } function asRep_eAdBoxBlur(){ asRep_tAdBoxNo=-1; } var asRep_AdBoxWBeforeUnloadOld=null; function asRep_eAdBoxWBeforeUnload(w){ var ct=(new Date()).getTime(); if(asRep_tAdBoxNo>=0&&(ct-asRep_tAdBoxFocusTime<2000)){asRep_repAdBoxClick(ct,asRep_tAdBoxStatus,asRep_tAdBoxNo,1);w.focus();} if(asRep_AdBoxWBeforeUnloadOld)asRep_AdBoxWBeforeUnloadOld(); } function asRep_prepAdBoxTracking(w){ for(var i=0;i var asRep_tAdBoxNo=-1; var asRep_tAdBoxFocusNo=-1; var asRep_tAdBoxFocusTime=0; function asRep_eAdBoxMouseOver(adboxno){ asRep_tAdBoxNo=adboxno; } var asRep_AdBoxWMouseMoveOld=new Array(); function asRep_eAdBoxWMouseMove(e,fi){ asRep_tAdBoxNo=-1; if(asRep_AdBoxWMouseMoveOld[fi])asRep_AdBoxWMouseMoveOld[fi](e); } var asRep_AdBoxWFocusOld=new Array(); function asRep_eAdBoxWFocus(e,fi){ asRep_tAdBoxFocusNo=-1; if(asRep_AdBoxWFocusOld[fi])asRep_AdBoxWFocusOld[fi](e); } var asRep_AdBoxWBlurOld=new Array(); function asRep_eAdBoxWBlur(e,fi){ if(asRep_tAdBoxNo>=0){ asRep_tAdBoxFocusNo=asRep_tAdBoxNo; asRep_tAdBoxFocusTime=(new Date()).getTime(); asRep_repAdBoxClick(asRep_tAdBoxFocusTime,'Unknown (Gecko DOM Browser)',asRep_tAdBoxFocusNo,0); }else{ asRep_tAdBoxFocusNo=-1; } if(asRep_AdBoxWBlurOld[fi])asRep_AdBoxWBlurOld[fi](e); } var asRep_AdBoxWUnloadOld=null; function asRep_eAdBoxWUnload(e){ var ct=(new Date()).getTime(); if(asRep_tAdBoxFocusNo>=0&&(ct-asRep_tAdBoxFocusTime<9000))asRep_repAdBoxClick(ct,'Unknown (Gecko DOM Browser)',asRep_tAdBoxFocusNo,1); if(asRep_AdBoxWUnloadOld)asRep_AdBoxWUnloadOld(e); } function asRep_setWindEvents(w){ eval("w.do"+"cument.loca"+"tion.hr"+"ef"); var i0=asRep_AdBoxWMouseMoveOld.length; asRep_AdBoxWMouseMoveOld[i0]=asRep_addEvent(w.document,'mousemove',function(e){asRep_eAdBoxWMouseMove(e,i0);}); var i1=asRep_AdBoxWFocusOld.length; asRep_AdBoxWFocusOld[i1]=asRep_addEvent(w,'focus',function(e){asRep_eAdBoxWFocus(e,i1);}); var i2=asRep_AdBoxWBlurOld.length; asRep_AdBoxWBlurOld[i2]=asRep_addEvent(w,'blur',function(e){asRep_eAdBoxWBlur(e,i2);}); if(w.frames){ for(var i=0;i var asRep_tWFocusTime=0; var asRep_tAdBoxStatus=''; var asRep_tAdBoxFocusNo=-1; var asRep_tAdBoxFocusTime=0; var asRep_tAdBoxClickTimer=null; var asRep_mouseX=-1; var asRep_mouseY=-1; function asRep_wL(w){ if(typeof w.screenLeft != "undefined")return w.screenLeft; if(typeof w.screenX != "undefined")return w.screenX; return 0; } function asRep_wT(w){ if(typeof w.screenTop != "undefined")return w.screenTop; if(typeof w.screenY != "undefined")return w.screenY; return 0; } function asRep_wW(w){ if(w.document.body&& typeof w.document.body.clientWidth != "undefined")return w.document.body.clientWidth; if(w.documentElement&& typeof w.documentElement.clientWidth != "undefined")return w.documentElement.clientWidth; return w.innerWidth; } function asRep_wH(w){ if(w.document.body&& typeof w.document.body.clientHeight != "undefined")return w.document.body.clientHeight; if(w.documentElement&& typeof w.documentElement.clientHeight != "undefined")return w.documentElement.clientHeight; return w.innerHeight; } function asRep_oL(o){ return (o.offsetParent?asRep_oL(o.offsetParent):0)+(o.offsetLeft?o.offsetLeft:0); } function asRep_oT(o){ return (o.offsetParent?asRep_oT(o.offsetParent):0)+(o.offsetTop?o.offsetTop:0); } function asRep_scX(w){ if(typeof w.scrollX != "undefined")return w.scrollX; if(typeof w.pageXOffset != "undefined")return w.pageXOffset; if(w.document.body&& typeof w.document.body.scrollLeft != "undefined")return w.document.body.scrollLeft; return 0; } function asRep_scY(w){ if(typeof w.scrollY != "undefined")return w.scrollY; if(typeof w.pageYOffset != "undefined")return w.pageYOffset; if(w.document.body&& typeof w.document.body.scrollTop != "undefined")return w.document.body.scrollTop; return 0; } function asRep_AdBoxViewport(o){ var p=new Array(); var w=o.ownerWindow; p[0]=true; p[1]=asRep_oL(o)+asRep_wL(w)-asRep_scX(w); p[2]=asRep_oT(o)+asRep_wT(w)-asRep_scY(w); p[3]=p[1]+o.offsetWidth; p[4]=p[2]+o.offsetHeight; do{ var wl=asRep_wL(w); var wt=asRep_wT(w); var wr=wl+asRep_wW(w); var wb=wt+asRep_wH(w); if(wl>p[1])p[1]=wl; if(wt>p[2])p[2]=wt; if(wr=p[1]-10)&&(asRep_mouseX=p[2]-10)&&(asRep_mouseY150){ asRep_tAdBoxFocusNo=asRep_AdBoxFocused(); if(asRep_tAdBoxFocusNo>=0){ asRep_tAdBoxStatus=w.status; asRep_tAdBoxFocusTime=ct; if(asRep_tAdBoxClickTimer)clearTimeout(asRep_tAdBoxClickTimer); // if(asRep_tAdBoxStatus)asRep_tAdBoxClickTimer=setTimeout("asRep_AdBoxSuspectedClick()",150); asRep_tAdBoxClickTimer=setTimeout("asRep_AdBoxSuspectedClick()",150); } } if(asRep_AdBoxWBlurOld[fi])asRep_AdBoxWBlurOld[fi](e); } function asRep_AdBoxSuspectedClick(){ asRep_tAdBoxClickTimer=null; asRep_repAdBoxClick(asRep_tAdBoxFocusTime,asRep_tAdBoxStatus,asRep_tAdBoxFocusNo,0); } var asRep_AdBoxWUnloadOld=null; function asRep_eAdBoxWUnload(e){ var ct=(new Date()).getTime(); if(asRep_tAdBoxFocusNo>=0&&(ct-asRep_tAdBoxFocusTime<9000))asRep_repAdBoxClick(ct,asRep_tAdBoxStatus,asRep_tAdBoxFocusNo,1); if(asRep_AdBoxWUnloadOld)asRep_AdBoxWUnloadOld(e); } function asRep_setWindEvents(w){ eval("w.do"+"cument.loca"+"tion.hr"+"ef"); var i0=asRep_AdBoxWMouseMoveOld.length; asRep_AdBoxWMouseMoveOld[i0]=asRep_addEvent(w.document,'mousemove',function(e){asRep_eAdBoxWMouseMove(e,i0,w);}); var i1=asRep_AdBoxWFocusOld.length; asRep_AdBoxWFocusOld[i1]=asRep_addEvent(w,'focus',function(e){asRep_eAdBoxWFocus(e,i1);}); var i2=asRep_AdBoxWBlurOld.length; asRep_AdBoxWBlurOld[i2]=asRep_addEvent(w,'blur',function(e){asRep_eAdBoxWBlur(e,i2,w);}); if(w.frames){ for(var i=0;i function asRep_prepClickTracking(w){ if (asRep_adBoxes.length || asRep_sBoxes.length)asRep_repILSWUnloadOld=asRep_addEvent(w,'unload',asRep_eRepILSWUnload,false); asRep_prepSBoxTracking(); asRep_prepAdBoxTracking(w); } function asRep_prepClickTracking(w){} function asRep_prepTracking(){ asRep_adBoxes=asRep_gasAdBoxesAll(asRep_workWind,); asRep_sBoxes=asRep_gasSearchBoxesAll(asRep_workWind,); asRep_repView(asRep_workWind); asRep_prepClickTracking(asRep_workWind); } var asRep_WOnloadOld=null; asRep_WOnloadOld=asRep_addEvent(asRep_workWind,'load',function(e){asRep_prepTracking();if(asRep_WOnloadOld)asRep_WOnloadOld(e);}); asRep_prepTracking(); var asRep_WOnloadOld=null; asRep_WOnloadOld=asRep_addEvent(asRep_workWind,'load',function(e){asRep_repAltAds();if(asRep_WOnloadOld)asRep_WOnloadOld(e);});