Файл: index.php
Строк: 83
<?php
require_once('core/start.php');
$title = 'Главная страница';
require_once(root.'core/header.php');
echo '<div class="h"><img src="icon/logo.png"/></div>';
// Запись гостей
if (empty($_COOKIE['cookie_id'])) {
if(core::$dbs->querySingle("SELECT COUNT(ip) FROM session WHERE id_session = ?",array(session_id()))==0){
core::$dbs->query("INSERT INTO session SET ip = ?, ua = ?, id_session = ?, date = ?, pereh = ?",array($ip,$ua,session_id(),time(),1));
} else {
core::$dbs->query("UPDATE session SET ip = ?, ua = ?, date = ?, pereh = pereh + ? WHERE id_session = ?",array($ip,$ua,time(),1,session_id()));
}
core::$dbs->query("DELETE FROM session WHERE date < ?",array(time()-1200));
}
$usr = (!empty($user['id']) ? $nick : 'Гость.');
echo '<center><div class="ot4">' . hi($usr). '</center></div>';
$admin = ($user['level']==1 ? '<div class="lenk"><a href="admin.html">Админка</a></div> ':'');
echo '<center><div class="new">'.(empty($user['id']) ? '<div class="lenk"><a href="login.html">Вход</a></div><div class="lenk"> <a href="signup.html">Регистрация</a></div>': $admin . ' <div class="lenk"><a href="office.html">Кабинет</a></div> <div class="lenk"><a href="exit.html">Выход</a></div>').'</div></center>';
echo ' <div class="ot4"><img src="icon/ik3.png" class="vt" alt=""/> Записи</div>';
$count = core::$dbs->querySingle("SELECT count(id) FROM `blog`");
$n = new pager($count,$index_end,'?');
$array = core::$dbs->query("SELECT * FROM `blog` ORDER BY `time` DESC LIMIT $n->start,$index_end");
if($array->rowCount()==0) err('Записей нет!');
while($arr = $array -> fetch()){
$message = (mb_strlen($arr['text'])>120 ? mb_substr($arr['text'],0,120, 'UTF-8') . '...': out($arr['text']) . '');
echo '<div class="vib"><b>'.stripslashes($arr['name']).'</b> ['.times($arr['time']).']</div>
<div class="block">
<p>' . $message .'</p><p><br/> '.(strlen($arr['text'])>120 ? '<a class="lenk" href="/blog/'.$arr['latname'].'.html">Далее →</a> |':NULL).' <a class="lenk" href="/comment/'.$arr['id'].'">Мнения ('.core::$dbs->querySingle("SELECT COUNT(id) from `comments` where `blog` = ?",array($arr['id'])).')</a></p></div>';
}
echo $n->pag();
echo '</div>';
echo '<div class="ot4"><img src="icon/add.png" class="vt" alt=""/> Меню</div>
</div><div class="vib2"><img src="icon/b.png" class="vt" alt=""/> <a href="top.html">TOP 10</a>
</div><div class="vib2"><img src="icon/ik2.png" class="vt" alt=""/> <a href="other/search.html">Поиск</a>
</div> <div class="vib"><img src="icon/ik1.png" class="vt" alt=""/>
<a href="other/about.html">Связь</a></div> <div class="vib"><img src="icon/ik5.png" class="vt" alt=""/> <a href="online.html">Онлайн</a> ('. core::$dbs->querySingle("SELECT count(id) FROM `users` WHERE `onl` > ?",array(time()-$onl)).'/'.core::$dbs->querySingle("SELECT count(ip) FROM session WHERE date > ?",array(time()-300)).')
</div> <div class="vib"><img src="icon/ik8.png" class="vt" alt=""/> <a href="other/stat.html">Статистика блога</a></div>';
require_once(root.'core/footer.php');
echo '<center> <a href="http://topstat.info/go/1627"><img src="http://topstat.info/imageOther/1627" alt="topstat.info"/></a></center>';
?>