$file_unique = $_SERVER['DOCUMENT_ROOT'].'/cache/ip/'.$date.'/unique_visitors'; $current = file_get_contents($file_unique); $cr = explode(',',$current); if(count($cr) > 0){ if(strpos($current,getIP()."|".$registry["post"][0]["id"]."|".$registry['post'][0]['cat']."|".$registry['post'][0]['user']."|".$date) == false){ $current = $current . getIP()."|".$registry["post"][0]["id"]."|".$registry['post'][0]['cat']."|".$registry['post'][0]['user']."|".$date.","; file_put_contents($file_unique, $current); } } } //$check_visitor = $DB->getOne('SELECT id FROM #__unique_visitors WHERE news_id="'.$registry["post"][0]["id"].'" and ip="'.getIP().'" and date="'.$date.'"'); $DB->execute('INSERT INTO #__unique_visitors (news_id,cat,user,ip,date) VALUES ("'.$registry["post"][0]["id"].'","'.$registry['post'][0]['cat'].'","'.$registry['post'][0]['user'].'","'.getIP().'","'.$date.'")'); }*/ if (!file_exists($_SERVER['DOCUMENT_ROOT'] . '/cache/ip/' . $date . '/' . getIP() . '-' . $registry["post"][0]["id"])) { $DB->execute('INSERT INTO #__unique_visitors (news_id,cat,user,ip,date) VALUES ("' . $registry["post"][0]["id"] . '","' . $registry['post'][0]['cat'] . '","' . $registry['post'][0]['user'] . '","' . getIP() . '","' . $date . '")'); } $check_visitor = getOnecache('SELECT id FROM #__unique_visitors WHERE news_id="' . $registry["post"][0]["id"] . '" and ip="' . getIP() . '" and date="' . $date . '"', 86400, 'ip/' . $date . '/' . getIP() . '-' . $registry["post"][0]["id"]); } } if (isset($_GET['dcat'])) { $registry['doctype'] = 'category'; $title = PHP_slashes(htmlspecialchars(strip_tags($_GET['dcat']))); $registry['posts'] = getAllcache('SELECT #__news.*,#__category.name,#__users.realname,#__category.cat_chpu,#__category.id as cat_id FROM #__news LEFT JOIN #__category ON #__category.id = #__news.cat LEFT JOIN #__users ON #__users.id = #__news.user WHERE #__category.cat_chpu = "' . $title . '" and #__category.section = "post" and #__news.moderate=1 and #__news.date <= ' . $time . ' order by #__news.date DESC LIMIT 14', 600, $_GET['dcat']); $registry['title'] = $registry['posts'][0]['name']; }
<?php if (!empty($_POST['changereg'])) { //if(intval($_POST['changereg'])==-1) $_POST['changereg']=0; setcookie('changereg', intval($_POST['changereg']), time() + 3600 * 48, '/'); $changereg = intval($_POST['changereg']); } else { if (!empty($_COOKIE['changereg'])) { $changereg = intval($_COOKIE['changereg']); if ($changereg == -1) { $changereg = 0; } } else { $changereg = $registry['region_default']; } } $registry['changereg'] = $changereg; $registry['ogim'] = "http://funtime.ge/img/fbs.png"; $registry['desc'] = "ინტერნეტჟურნალი"; $registry['url'] = "http://funtime.ge"; $registry['header_img'] = getOnecache('SELECT value FROM #__setting WHERE name="header_img"', 2000, 'header'); $registry['deviceType'] = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer'; create_date_folder($_SERVER['DOCUMENT_ROOT'] . '/img/uploads/news/fb/'); create_date_folder($_SERVER['DOCUMENT_ROOT'] . '/img/uploads/news/read/'); create_date_folder($_SERVER['DOCUMENT_ROOT'] . '/img/uploads/news/prev/'); create_date_folder($_SERVER['DOCUMENT_ROOT'] . '/cache/ip/', '-d');