Ejemplo n.º 1
0
}
if ($Skip) {
    return NS_TRACK_GENERAL::FinishTracking();
}
$Fraud = NS_TRACK_GENERAL::CheckClickFraud($Settings, $VisId, $ClickSubId);
NS_TRACK_GENERAL::UpdateVisitorAction();
if (NS_TRACK_MISC::ValidId($ClickSubId) && $ClickSubId > 0) {
    NS_TRACK_GENERAL::UpdateVisitorClick();
}
if ($UpdateVisPath || $KeepVisPath) {
    NS_TRACK_GENERAL::UpdateVisitorPath();
}
if ($CookieLogSet && NS_TRACK_GENERAL::CheckTrackingMode()) {
    $CookieLogSet = false;
}
if ($CookieLogSet) {
    NS_TRACK_GENERAL::SetCookieLog();
}
if ($FindLastNode) {
    NS_TRACK_VISITOR::FindLastNode($VisId);
}
NS_TRACK_VISITOR::UpdateByRegs();
if (defined("TRACK_ERRORS") && TRACK_ERRORS && !defined("NS_PHP_TRACKING")) {
    $ResTime = NS_TRACK_MISC::GetMicrotime() - $StartTime;
    $Query = "INSERT INTO track_time (TRACK_TIME) VALUES ('{$ResTime}')";
    $Db->Query($Query);
    for ($i = 0; $i < count($Logs->Errors); $i++) {
        $Db->Query("INSERT INTO track_error (ERROR) VALUES ('" . addslashes($Logs->Errors[$i]) . "')");
    }
}
return NS_TRACK_GENERAL::FinishTracking();
Ejemplo n.º 2
0
if ($Skip) {
    NS_TRACK_MISC::Redir($RUrl);
}
$Fraud = NS_TRACK_GENERAL::CheckClickFraud($Settings, $VisId, $ClickSubId);
if (NS_TRACK_MISC::ValidId($ClickSubId) && $ClickSubId > 0) {
    NS_TRACK_GENERAL::UpdateVisitorClick();
}
if ($UpdateVisPath || $KeepVisPath) {
    NS_TRACK_GENERAL::UpdateVisitorPath();
}
$nsUser->SetCookie(NS_COOKIE_PFX . 'tmp_skip', '1', 120, '/');
if ($CookieLogSet && NS_TRACK_GENERAL::CheckTrackingMode()) {
    $CookieLogSet = false;
}
if ($CookieLogSet) {
    NS_TRACK_GENERAL::SetCookieLog();
}
if ($FindLastNode) {
    NS_TRACK_VISITOR::FindLastNode($VisId);
}
if (defined("TRACK_ERRORS") && TRACK_ERRORS && !defined("NS_PHP_TRACKING")) {
    $ResTime = NS_TRACK_MISC::GetMicrotime() - $StartTime;
    $Query = "INSERT INTO track_time (TRACK_TIME) VALUES ('{$ResTime}')";
    $Db->Query($Query);
    for ($i = 0; $i < count($Logs->Errors); $i++) {
        $Db->Query("INSERT INTO track_error (ERROR) VALUES ('" . addslashes($Logs->Errors[$i]) . "')");
    }
}
//if ($CurrentPageArr['query']) $RUrl.="&ns_skip=1";
//else $RUrl.="?ns_skip=1";
NS_TRACK_MISC::Redir($RUrl);
Ejemplo n.º 3
0
$Frame = NS_TRACK_MISC::ValidVar($_GP['frame']);
$Current = false;
if (NS_TRACK_MISC::ValidVar($_SERVER['HTTP_REFERER'])) {
    $Current = $_SERVER['HTTP_REFERER'];
}
if (NS_TRACK_MISC::ValidVar($Cur)) {
    $Current = $Cur;
}
$StId = NS_TRACK_MISC::ValidId($_GP['st']) ? $_GP['st'] : false;
$Cost = NS_TRACK_MISC::ValidVar($_GP['cs'], 0);
$CustomId = NS_TRACK_MISC::ValidVar($_GP['oid']);
$AddInfo = NS_TRACK_MISC::ValidVar($_GP['oinfo']);
$Site = $Db->Select("SELECT * FROM " . NS_DB_PFX . "_tracker_site WHERE ID = {$StId}");
$CompanyId = $Site->COMPANY_ID;
$Settings = NS_TRACK_MISC::GetSettings($CompanyId, $StId);
$VisId = NS_TRACK_VISITOR::GetVisitorId();
if (NS_TRACK_MISC::ValidVar($_COOKIE['ns_skip'])) {
    $Skip = true;
}
if ($Skip || !NS_TRACK_MISC::ValidId($StId)) {
    return NS_TRACK_GENERAL::FinishTracking();
}
$KeepNoRef = NS_TRACK_MISC::SetsByPrior($Settings, "KEEP_NO_REF");
$NoDblSale = NS_TRACK_MISC::SetsByPrior($Settings, "STOP_DBL_SALE");
$TimeDblSale = NS_TRACK_MISC::TimeDblSettings($Settings, "STOP_DBL_SALE", "TIME_DBL_SALE");
if (!$KeepNoRef && !NS_TRACK_MISC::ValidId($_COOKIE['ns_log'])) {
    $Skip = true;
}
if ($Skip) {
    return NS_TRACK_GENERAL::FinishTracking();
}
Ejemplo n.º 4
0
 function GetVisitorId()
 {
     global $nsUser, $nsProduct;
     global $_NS_TRACK_VARS, $_COOKIE;
     $Skip =& $_NS_TRACK_VARS['Skip'];
     $IpId =& $_NS_TRACK_VARS['IpId'];
     $AgentId =& $_NS_TRACK_VARS['AgentId'];
     $PresetID =& $_NS_TRACK_VARS['PresetID'];
     $PresetIP =& $_NS_TRACK_VARS['PresertIP'];
     $Settings =& $_NS_TRACK_VARS['Settings'];
     $ScrRes =& $_NS_TRACK_VARS['ScrRes'];
     $PxD =& $_NS_TRACK_VARS['PxD'];
     $FlVer =& $_NS_TRACK_VARS['FlVer'];
     $CheckCookieId =& $_NS_TRACK_VARS['CheckCookieId'];
     $Db =& $_NS_TRACK_VARS['Db'];
     $FindLastNode =& $_NS_TRACK_VARS['FindLastNode'];
     $UserAgent = NS_TRACK_MISC::ValidVar($_SERVER['HTTP_USER_AGENT']);
     if (!trim($UserAgent)) {
         $Skip = true;
         return 0;
     }
     $AgentId = NS_TRACK_VISITOR::GetUserAgentId($UserAgent);
     $Visitor = false;
     $CookieId = false;
     $CountryId = 0;
     $ScrRes = addslashes($ScrRes);
     $PxD = addslashes($PxD);
     $FlVer = addslashes($FlVer);
     if (strpos($FlVer, "<") !== false) {
         $FlVer = substr($FlVer, 0, strpos($FlVer, "<"));
     }
     if (!$FlVer) {
         $FlVer = "-1";
     }
     if ($FlVer != "-1") {
         $FlVer = substr($FlVer, 0, 1);
     }
     if (!$ScrRes || $ScrRes == "x" || $ScrRes == 0) {
         $ScrRes = "-1";
     }
     if (!$PxD) {
         $PxD = "-1";
     }
     if (isset($_COOKIE[NS_COOKIE_PFX . 'tmp_skip'])) {
         NS_TRACK_GENERAL::TrackingCookie(NS_COOKIE_PFX . 'tmp_skip', '0', time() - 60, '/');
         $Skip = true;
     }
     if ($Skip) {
         return 0;
     }
     $Stamp = gmdate("Y-m-d H:i:s", time());
     $UserIp = NS_TRACK_VISITOR::GetUserIp();
     $IpId = NS_TRACK_VISITOR::GetIpId($UserIp);
     if ($Skip) {
         return 0;
     }
     if (NS_TRACK_MISC::ValidVar($PresetID) && NS_TRACK_MISC::ValidId($PresetID)) {
         $Visitor = $Db->Select("SELECT * FROM " . NS_DB_PFX . "_tracker_visitor WHERE ID = {$PresetID}");
         if (NS_TRACK_MISC::ValidId($Visitor->ID)) {
             $AgentId = $Visitor->LAST_AGENT_ID ? $Visitor->LAST_AGENT_ID : $AgentId;
             return $PresetID;
         }
     }
     if (!NS_TRACK_MISC::ValidVar($PresetID) || !NS_TRACK_MISC::ValidVar($Visitor->ID)) {
         if (defined("NS_PHP_TRACKING") && $Settings['All']->IP_TRACKING && $Settings['All']->IP_NO_COOKIE && count($_COOKIE) > 0) {
             $Settings['All']->IP_TRACKING = false;
         }
         if (!defined("NS_PHP_TRACKING")) {
             if (!$CheckCookieId && !isset($_COOKIE[NS_COOKIE_PFX . 'visitor']) && $Settings['All']->IP_TRACKING && $Settings['All']->IP_NO_COOKIE) {
                 $CookieId = NS_TRACK_VISITOR::TrackingVisitorCookie();
                 NS_TRACK_MISC::Redir(NS_TRACK_MISC::ns_my_url() . "&CheckCookieId={$CookieId}");
             }
             if ($CheckCookieId && isset($_COOKIE[NS_COOKIE_PFX . 'visitor']) && $_COOKIE[NS_COOKIE_PFX . 'visitor'] == $CheckCookieId) {
                 $Settings['All']->IP_TRACKING = false;
             }
         }
         if (!isset($_COOKIE[NS_COOKIE_PFX . 'visitor']) && $Settings['All']->IP_TRACKING) {
             $Visitor = NS_TRACK_VISITOR::FindByIp($IpId, $AgentId, $Settings['All']->IP_PERIOD);
             if ($Visitor) {
                 $CookieId = NS_TRACK_VISITOR::TrackingVisitorCookie($Visitor->COOKIE_ID);
                 NS_TRACK_VISITOR::FindLastNode($Visitor->ID);
                 $FindLastNode = false;
             }
         }
         if (!$CookieId) {
             $CookieId = NS_TRACK_VISITOR::TrackingVisitorCookie();
         }
         if (!$Visitor) {
             $Query = "SELECT * FROM " . NS_DB_PFX . "_tracker_visitor WHERE COOKIE_ID='{$CookieId}'";
             $Visitor = $Db->Select($Query);
         }
     }
     if ($Visitor && NS_TRACK_MISC::ValidId($Visitor->ID)) {
         if (!$Visitor->FIRST_COUNTRY_ID) {
             $CountryId = NS_TRACK_VISITOR::GetCountryId($UserIp);
         } else {
             $CountryId = $Visitor->FIRST_COUNTRY_ID;
         }
         if ((!$ScrRes || $ScrRes == "-1") && $Visitor->LAST_RESOLUTION) {
             $ScrRes = $Visitor->LAST_RESOLUTION;
         }
         if ((!$PxD || $PxD == "-1") && $Visitor->PIXEL_DEPTH) {
             $PxD = $Visitor->PIXEL_DEPTH;
         }
         if ((!$FlVer || $FlVer == "-1") && $Visitor->FLASH_VERSION) {
             $FlVer = $Visitor->FLASH_VERSION;
         }
         $Query = "UPDATE " . NS_DB_PFX . "_tracker_visitor SET LAST_IP_ID = {$IpId}, LAST_AGENT_ID={$AgentId}, LAST_STAMP='{$Stamp}', FIRST_COUNTRY_ID='{$CountryId}', LAST_RESOLUTION = '{$ScrRes}', PIXEL_DEPTH='{$PxD}', FLASH_VERSION='{$FlVer}' WHERE ID = " . $Visitor->ID;
         $Db->Query($Query);
         NS_TRACK_VISITOR::TrackingVisitorCookie($Visitor->COOKIE_ID);
         return $Visitor->ID;
     }
     $CountryId = NS_TRACK_VISITOR::GetCountryId($UserIp);
     $Query = "INSERT INTO " . NS_DB_PFX . "_tracker_visitor (COOKIE_ID, LAST_IP_ID, LAST_AGENT_ID, FIRST_STAMP, LAST_STAMP, FIRST_COUNTRY_ID, LAST_RESOLUTION, PIXEL_DEPTH, FLASH_VERSION) VALUES ('{$CookieId}', {$IpId}, {$AgentId}, '{$Stamp}', '{$Stamp}', '{$CountryId}', '{$ScrRes}', '{$PxD}', '{$FlVer}')";
     $Db->Query($Query);
     $FindLastNode = false;
     return $Db->LastInsertId;
 }