$VisId = NS_TRACK_VISITOR::GetVisitorId(); if ($Skip) { NS_TRACK_MISC::Redir($RUrl); } $HostsArr = NS_TRACK_GENERAL::GetSiteHosts($StId, $Site); $SiteHostId = NS_TRACK_GENERAL::CurrentSiteHost($HostsArr, $CurrentPageArr, $Site); if (!$SiteHostId || $Skip) { Redir($RUrl); } $PageId = NS_TRACK_PAGE::GetPageId($CurrentPageArr, $StId); if ($Undef && $KeepVisPath) { NS_TRACK_GENERAL::UpdateStatUndef(); NS_TRACK_MISC::Redir($RUrl); } if ($Skip) { Redir($RUrl); } $GetVars = NS_TRACK_QUERY::ParseTemplate(NS_TRACK_MISC::ValidVar($CurrentPageArr['query'])); $Skip = NS_TRACK_MISC::ValidId($GetVars['ns_skip']) ? true : false; if ($Skip) { NS_TRACK_MISC::Redir($RUrl); } $KeyId = NS_TRACK_MISC::ValidId($_GP[$VarKeyword]) ? $_GP[$VarKeyword] : 0; $Keyword = NS_TRACK_MISC::ValidVar($_GP[$VarKw], false); if ($Keyword) { $KeyId = NS_TRACK_REFERER::GetKeywordId($Keyword); } $RefSet = NS_TRACK_REFERER::GetRefererSet($RefPageArr, $Ref); $QueryId = NS_TRACK_QUERY::GetQueryId($CurrentPageArr['query']); if (!$KeepNoRef && $RefSet == 0 && !NS_TRACK_MISC::ValidId($_COOKIE['ns_log']) && $ClickSubId != 0) { $Skip = true;
if ($DataArr[$i]['ID'] == $eid) { $Action = $DataArr[$i]; break; } } if (!$Action) { NS_TRACK_MISC::Redir($_SERVER['HTTP_REFERER']); } if (!NS_TRACK_MISC::ValidVar($Action['PATH']) && !NS_TRACK_MISC::ValidVar($Action['REDIRECT_URL'])) { Redir($_SERVER['HTTP_REFERER']); } if (NS_TRACK_MISC::ValidVar($Action['REDIRECT_URL'])) { Redir(urldecode($Action['REDIRECT_URL'])); } if (NS_TRACK_MISC::ValidVar($Action['PATH'])) { Redir(urldecode($Action['PATH'])); } exit; } $Settings = NS_TRACK_MISC::GetSettings($CompanyId, $StId); $VisId = NS_TRACK_VISITOR::GetVisitorId(); $Query = "SELECT * FROM " . NS_DB_PFX . "_tracker_visitor_action WHERE ID = {$eid}"; $Event = $Db->Select($Query); if ($Event->REDIRECT_URL) { $rurl = $Event->REDIRECT_URL; } $StId = $Event->SITE_ID; $Site = NS_TRACK_GENERAL::GetCurrentSite($Event->SITE_ID); $CompanyId = $Site->COMPANY_ID; if ($Event->ACTIVE != 1) { $Skip = true;
function MoveAgentToGrp($AgId = false, $GrpId = false) { global $Db, $AName; if ($GrpId == -1) { $GrpId = 0; } $Query = "UPDATE " . PFX . "_tracker_visitor_agent SET GRP_ID={$GrpId} WHERE ID={$AgId}"; $Db->Query($Query); Redir(strip_certain_req_vars(array("MoveAgent", "MoveToGrp", "AName")) . "#Vis{$AName}"); }
$Where = ""; } if ($PrevPageId && $PrevQueryId && $RememberPage) { $Where .= " AND TSP.QUERY_ID = '{$PrevQueryId}'"; } function nsSplitQuery($SplitId, $Where) { $Query = "\n\t\tSELECT \n\t\t\tTSP.*, TS.COMPANY_ID, TS.HOST, \n\t\t\tSP.PATH, TQ.QUERY_STRING, TS.ID AS SITE_ID, ST.SUB_ID, \n\t\t\tTSP.FULL_PATH AS PAGE_PATH\n\t\tFROM " . PFX . "_tracker_split_page TSP\n\t\tINNER JOIN " . PFX . "_tracker_split_test ST\n\t\t\tON ST.ID=TSP.SPLIT_ID\n\t\tINNER JOIN " . PFX . "_tracker_site_page SP\n\t\t\tON SP.ID = TSP.PAGE_ID\n\t\tINNER JOIN " . PFX . "_tracker_site TS\n\t\t\tON TS.ID = SP.SITE_ID\n\t\tLEFT JOIN " . PFX . "_tracker_query TQ\n\t\t\tON TQ.ID=TSP.QUERY_ID\n\t\tWHERE TSP.SPLIT_ID={$SplitId}\n\t\t\t{$Where}\n\t\tORDER BY RAND()\n\t\tLIMIT 1\n\t"; return $Query; } $Page = $Db->Select(nsSplitQuery($SplitId, $Where)); if (!NS_TRACK_MISC::ValidId($Page->ID)) { $Page = $Db->Select(nsSplitQuery($SplitId, "")); } if (!NS_TRACK_MISC::ValidId($Page->ID)) { Redir($Ref); exit; } if ($Page->PAGE_PATH) { $Current = $Page->PAGE_PATH; } else { $Current = "http://" . $Page->HOST . $Page->PATH; if ($Page->QUERY_STRING) { $Current .= "?" . $Page->QUERY_STRING; } } $Redir = $Current; $StId = $Page->SITE_ID; $Undef =& $_NS_TRACK_VARS['Undef']; $KeepVisPath = true; $CompanyId = $Page->COMPANY_ID;
$xref = $_SERVER['HTTP_REFERER']; } $xref = $redirect; } if (isset($_REQUEST['reauth'])) { $nsUser->Reauthorize(); } if (isset($_REQUEST['logout'])) { $nsUser->Logout(); Redir($nsProduct->SelfAction()); } if (isset($_REQUEST['go_auth'])) { if (!ValidVar($_REQUEST['recall'])) { $_REQUEST['recall'] = false; } $nsUser->Login($_REQUEST['xlogin'], $_REQUEST['xpwd'], $_REQUEST['recall']); if (!$nsUser->Logged()) { $Logs->Err($Lang['LoginErr1']); } } if ($nsUser->Logged()) { if (ValidVar($xref)) { Redir($xref); } else { $nsProduct->Redir("default"); } } $xlogin = ValidVar($_GP['xlogin']); $PageTitle = $Lang['Title']; $TableCaption = $Lang['LoginPass']; include $nsTemplate->Inc();
function ImportReport($Id = false) { if (!$Id) { return false; } global $Db, $nsUser, $CpId, $nsProduct; $Where = ""; if (!$nsUser->ADMIN) { $Where = "AND COMPANY_ID=" . $nsUser->COMPANY_ID; } $Query = "SELECT * FROM " . PFX . "_tracker_user_report WHERE ID = {$Id} {$Where}"; $Import = $Db->Select($Query); if (!ValidId($Import->ID)) { return false; } if ($Import->COMPANY_ID > 0 && $Import->COMPANY_ID != $CpId) { Redir($nsProduct->SelfAction("CpId=" . $Import->COMPANY_ID . "&ConstId=" . $Import->ID)); } $WhereArr = unserialize($Import->WHERE_ARR); if (!ValidArr($WhereArr)) { return false; } for ($i = 0; $i < count($WhereArr); $i++) { if (!ValidVar($WhereArr[$i]['OrderBy'])) { $WhereArr[$i]['OrderBy'] = "CNT"; } if (!ValidVar($WhereArr[$i]['OrderTo'])) { $WhereArr[$i]['OrderTo'] = "DESC"; } } $GLOBALS['WhereArr'] = $WhereArr; $DatesUsed = false; for ($i = 0; $i < count($WhereArr); $i++) { if ($WhereArr[$i]['Mode'] == "Month" || $WhereArr[$i]['Mode'] == "Date") { $DatesUsed = true; break; } } if (!$DatesUsed) { $ViewDate = $Import->VIEW_DATE != "0000-00-00" && ValidDate($Import->VIEW_DATE) ? $Import->VIEW_DATE : false; $StartDate = $Import->START_DATE != "0000-00-00" && ValidDate($Import->START_DATE) ? $Import->START_DATE : false; $EndDate = $Import->END_DATE != "0000-00-00" && ValidDate($Import->END_DATE) ? $Import->END_DATE : false; if ($ViewDate && $Import->USE_CURRENT_DATE) { $ViewDate = date("Y-m-d"); } if ($EndDate && $Import->USE_CURRENT_DATE) { $EndDate = date("Y-m-d"); } if ($Import->USE_CURRENT_DATE && !$ViewDate && !$EndDate) { $ViewDate = date("Y-m-d"); } $GLOBALS['ViewDate'] = $ViewDate; $GLOBALS['StartDate'] = $StartDate; $GLOBALS['EndDate'] = $EndDate; } $GLOBALS['Limit'] = ValidVar($Import->PAGE_LIMIT) > 0 ? $Import->PAGE_LIMIT : false; $GLOBALS['Filter'] = ValidVar($Import->FILTER); $GLOBALS['ShowAll'] = $Import->SHOW_NO_REF == 1 ? 1 : false; $GLOBALS['OrderBy'] = ValidVar($Import->SORT_BY); $GLOBALS['OrderTo'] = $Import->SORT_ORDER; $GLOBALS['GroupBy'] = ValidVar($Import->GROUP_BY); return true; }