Exemplo n.º 1
0
 function GetPageId($PathArr = false, $StId = false)
 {
     if (!$PathArr || !$StId) {
         return 0;
     }
     global $_NS_TRACK_VARS;
     $Skip =& $_NS_TRACK_VARS['Skip'];
     $Db =& $_NS_TRACK_VARS['Db'];
     $Undef =& $_NS_TRACK_VARS['Undef'];
     $Site =& $_NS_TRACK_VARS['Site'];
     $HostsArr =& $_NS_TRACK_VARS['HostsArr'];
     $SSL =& $_NS_TRACK_VARS['SSL'];
     if (!isset($HostsArr[NS_TRACK_MISC::ToLower($PathArr['host'])])) {
         $Undef = true;
         $Skip = true;
         return 0;
     }
     if (NS_TRACK_MISC::ValidVar($PathArr['scheme']) == "https") {
         $SSL = true;
     }
     $Path = $PathArr['path'];
     $Query = "SELECT ID, IGNORE_PAGE FROM " . NS_DB_PFX . "_tracker_site_page WHERE PATH = '{$Path}' AND SITE_ID={$StId}";
     $Check = $Db->Select($Query);
     if (isset($Check->IGNORE_PAGE) && $Check->IGNORE_PAGE) {
         $Skip = true;
         $Undef = true;
         return 0;
     }
     if (NS_TRACK_MISC::ValidId($Check->ID)) {
         return $Check->ID;
     }
     $Query = "INSERT INTO " . NS_DB_PFX . "_tracker_site_page (SITE_ID, PATH) VALUES ({$StId}, '{$Path}')";
     $Db->Query($Query);
     return $Db->LastInsertId;
 }
Exemplo n.º 2
0
 function GetSettings($CompId = false, $SiteId = false)
 {
     $Where = array();
     $Where[] = "(COMPANY_ID=0 AND SITE_ID=0)";
     if (NS_TRACK_MISC::ValidId($CompId)) {
         $Where[] = "(COMPANY_ID={$CompId} AND SITE_ID=0)";
     }
     if (NS_TRACK_MISC::ValidId($SiteId)) {
         $Where[] = "SITE_ID={$SiteId}";
     }
     $WhereStr = "WHERE " . implode(" OR ", $Where);
     $Pfx = defined("NS_DB_PFX") ? NS_DB_PFX : PFX;
     global $_NS_TRACK_VARS;
     $QueryClass = isset($_NS_TRACK_VARS['QueryClass']) ? $_NS_TRACK_VARS['QueryClass'] : "Query";
     $Query = "SELECT * FROM " . $Pfx . "_tracker_config {$WhereStr}";
     $Sql = new $QueryClass($Query);
     $Sets = array();
     while ($Row = $Sql->Row()) {
         if ($Row->COMPANY_ID == 0) {
             $Sets['All'] = $Row;
         }
         if ($Row->COMPANY_ID > 0 && $Row->SITE_ID == 0) {
             $Sets['Client'] = $Row;
         }
         if ($Row->COMPANY_ID > 0 && $Row->SITE_ID > 0) {
             $Sets['Site'] = $Row;
         }
     }
     return $Sets;
 }
Exemplo n.º 3
0
 function GetQueryId($Qr = false)
 {
     if (!$Qr) {
         return 0;
     }
     global $_NS_TRACK_VARS;
     $Db =& $_NS_TRACK_VARS['Db'];
     $Qr = NS_TRACK_MISC::escape_string($Qr);
     $Query = "SELECT ID FROM " . NS_DB_PFX . "_tracker_query WHERE MD5_SEARCH=MD5('{$Qr}')";
     $CheckId = $Db->ReturnValue($Query);
     if (NS_TRACK_MISC::ValidId($CheckId)) {
         return $CheckId;
     }
     $Query = "INSERT INTO " . NS_DB_PFX . "_tracker_query (QUERY_STRING, MD5_SEARCH) VALUES ('{$Qr}', MD5('{$Qr}'))";
     $Db->Query($Query);
     return NS_TRACK_MISC::ValidId($Db->LastInsertId) ? $Db->LastInsertId : 0;
 }
Exemplo n.º 4
0
 function GetActionItemId($ItemName = false, $CompanyId = false)
 {
     if (!$ItemName || !$CompanyId) {
         return 0;
     }
     global $_NS_TRACK_VARS;
     $Db =& $_NS_TRACK_VARS['Db'];
     $ItemName = addslashes($ItemName);
     $Query = "SELECT ID FROM " . NS_DB_PFX . "_tracker_action_item WHERE NAME='{$ItemName}' AND COMPANY_ID={$CompanyId}";
     $CheckId = $Db->ReturnValue($Query);
     if (NS_TRACK_MISC::ValidId($CheckId)) {
         return $CheckId;
     }
     $Query = "INSERT INTO " . NS_DB_PFX . "_tracker_action_item (COMPANY_ID, NAME) VALUES ({$CompanyId}, '{$ItemName}')";
     $Db->Query($Query);
     return $Db->LastInsertId;
 }
Exemplo n.º 5
0
}
if ($Skip) {
    return NS_TRACK_GENERAL::FinishTracking();
}
if ($NoDblPageLoad) {
    NS_TRACK_GENERAL::CheckPathDblClick();
}
if ($NoDblAdvClick) {
    NS_TRACK_GENERAL::CheckAdvDblClick();
}
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();
Exemplo n.º 6
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();
}
$HostsArr = NS_TRACK_GENERAL::GetSiteHosts($StId, $Site);
$CurrentPageArr = NS_TRACK_GENERAL::PreparePathAddr($Current);
$SiteHostId = NS_TRACK_GENERAL::CurrentSiteHost($HostsArr, $CurrentPageArr, $Site);
if (!$SiteHostId) {
    $Skip = true;
}
if ($Skip) {
    return NS_TRACK_GENERAL::FinishTracking();
}
$RefSet = 0;
Exemplo n.º 7
0
 function CurrentSiteHost($HostsArr = false, $PathArr = false, $Site = false)
 {
     $HostId = 0;
     if (!$PathArr || !$HostsArr) {
         return 0;
     }
     if (isset($HostsArr[NS_TRACK_MISC::ToLower($PathArr['host'])])) {
         $HostId = $HostsArr[NS_TRACK_MISC::ToLower($PathArr['host'])]->ID;
     }
     if (!$HostId && $Site && !$Site->USE_HOSTS) {
         return NS_TRACK_GENERAL::AddNewSiteHost($Site->ID, $PathArr['host']);
     }
     return NS_TRACK_MISC::ValidId($HostId) ? $HostId : 0;
 }
Exemplo n.º 8
0
 function GetUserAgentId($Agent = false)
 {
     if (!$Agent) {
         return 0;
     }
     global $_NS_TRACK_VARS;
     $Skip =& $_NS_TRACK_VARS['Skip'];
     $Db =& $_NS_TRACK_VARS['Db'];
     $Agent = addslashes($Agent);
     $Query = "\n\t\tSELECT \n\t\t\tVA.ID, VA.BAN, AG.BAN AS GBAN\n\t\t\tFROM " . NS_DB_PFX . "_tracker_visitor_agent VA\n\t\t\tLEFT JOIN " . NS_DB_PFX . "_tracker_visitor_agent_grp AG\n\t\t\t\tON AG.ID=VA.GRP_ID\n\t\t\tWHERE VA.MD5_SEARCH=MD5('{$Agent}')\n\t";
     $Check = $Db->Select($Query);
     if (NS_TRACK_MISC::ValidVar($Check->BAN) == 1 || NS_TRACK_MISC::ValidVar($Check->GBAN) == 1) {
         $Skip = true;
         return 0;
     }
     if (NS_TRACK_MISC::ValidId($Check->ID)) {
         return $Check->ID;
     }
     $GrpId = 0;
     $Query = "INSERT INTO " . NS_DB_PFX . "_tracker_visitor_agent (GRP_ID, USER_AGENT, MD5_SEARCH) VALUES ({$GrpId}, '{$Agent}', MD5('{$Agent}'))";
     $Db->Query($Query);
     return $Db->LastInsertId;
 }
Exemplo n.º 9
0
 function GetKeywordId($Key = false)
 {
     if (!$Key) {
         return 0;
     }
     global $_NS_TRACK_VARS;
     $Db =& $_NS_TRACK_VARS['Db'];
     $Key = NS_TRACK_MISC::escape_string($Key);
     $Query = "SELECT ID FROM " . NS_DB_PFX . "_tracker_keyword WHERE MD5_SEARCH=MD5('{$Key}')";
     $CheckId = $Db->ReturnValue($Query);
     if (NS_TRACK_MISC::ValidId($CheckId)) {
         return $CheckId;
     }
     $Query = "INSERT INTO " . NS_DB_PFX . "_tracker_keyword (KEYWORD, MD5_SEARCH) VALUES ('{$Key}', MD5('{$Key}'))";
     $Db->Query($Query);
     return $Db->LastInsertId;
 }