// identify visitor if(!empty($visitor_id) && (false === $db->selectValue("select Visitor_ID from {$tblPref}Visitor where Visitor_ID = ".$visitor_id))) unset($visitor_id); if(empty($visitor_id)) { $ip = getIP(); $visitor_id = $db->selectValue( "select Visitor_ID ". "from {$tblPref}Visitor ". "where IP = '$ip'" ); if(false === $visitor_id) { $visitor_id = $db->insert( "{$tblPref}Visitor", array("IP" => $ip) ); //debug("New visitor detected: '$ip' => $visitor_id"); } //else debug("Identified visitor by IP: $ip"); } //else debug("Identified visitor by cookie: $visitor_id"); // save visitor_id in cookies setcookie("visitor_id", $visitor_id, time()+12*30*86400); // identify referer if exists if(!empty($HTTP_REFERER) && !preg_match("`".__CFG_MAIN_HTTP_ROOT."`", $HTTP_REFERER)) { $referer_id = $db->selectValue( "select Referer_ID ". "from {$tblPref}Referer ". "where Referer = lower('$HTTP_REFERER')" ); if(false === $referer_id) $referer_id = $db->execute( "insert into {$tblPref}Referer (Referer) ". "values (lower('$HTTP_REFERER'))" ); } else $referer_id = 0; // save visit data if(!$sid->assigned("visit_id")) $sid->assign( "visit_id", $db->insert( "{$tblPref}Visit", array( "Visitor_ID" => $visitor_id, "Referer_ID" => $referer_id, "VisitDateTime" => date("Y-m-d H:i:s") ) ) ); // retrieve subjects list $tpl->assign( "subjects", $db->selectValues( "select t.Translation, sb.Subject_ID ". "from {$tblPref}Subject sb, ". "{$tblPref}StrConst s, {$tblPref}StrConstTranslation t ". "where s.Index_ID = sb.Subject_ID ". "and s.VarName = 'Subject' ". "and s.Constant_ID = t.Constant_ID ". "and t.Encoding_ID = ".$encoding_id." ". "order by t.Translation", "Subject_ID" ) ); $tpl->assign("search_for", empty($search_for) ? "" : $search_for); $tpl->assign("search_subject", empty($search_subject) ? 0 : $search_subject); // get member points balance if($sid->assigned("user")) $tpl->assign( "points_left", $db->selectValue( "select Points ". "from {$tblPref}Member ". "where Member_ID = ".$sid->fetch_property("user", "Member_ID") ) ); // process login notifications $tpl->assign( "username", $sid->assigned("username") ? $sid->fetch("username") : (empty($_COOKIE[$area."_username"]) ? "" : $_COOKIE[$area."_username"]) ); if($sid->assigned("username")) $sid->unassign("username"); $tpl->assign( "password", empty($_COOKIE[$area."_password"]) ? "" : $_COOKIE[$area."_password"] ); $tpl->assign("login_notice", $sid->assigned("login_notice") ? $sid->fetch("login_notice") : ""); if($sid->assigned("login_notice")) $sid->unassign("login_notice"); $scroller_ads = empty($scroller_ads) ? 0 : $scroller_ads; if($scroller_ads<3) { $tpl->assign('show_scroller_ads', 1); setcookie('scroller_ads', ++$scroller_ads, time()+1296000, "/"); // 15 days } include_once(__CFG_PATH_SRC.$pg.".".$act.".php"); ?> Slinkoju.lv - Esejas
Slinkoju.lv
Meklēt 

Temats   





Reģistrētu eseju temati

Dati netika atrasti


Pirmdiena Novembris 19, 2018