<?php
// Навигация
function navigation($p, $pages, $url) {
$html = '';
$next = $p + 1;
$prev = $p - 1;
if ( $prev >= 1 ) {
$html .= '<a href="' . htmlentities($url) . '&p=' . $prev . '">Назад</a>';
}
if ( $prev > 0 && $next <= $pages ) $html .= ' / ';
if ( $next <= $pages ) {
$html .= '<a href="' . htmlentities($url) . '&p=' . $next . '">Вперед</a>';
}
return $html;
}
// Шаблон верха страницы
function head() {
$html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<style type="text/css">
body { font-family: Arial,Tahoma; font-size: 12px; color: #008000; padding: 0px; margin: 0px; }
a { color: #228B22; text-decoration: none; }
.head { border-bottom: solid 2px #32CD32; padding: 2px; margin: 0px; }
.menu {
background-color: #e2e2e2;
color: #6b6b6b;
text-shadow: 0 0 2px #8e8e8e;
text-align: left;
border: 1px solid #c7c7c7;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
margin: 1px;
padding: 2px;
padding-left: 5px;
}
</style>
<title>WAP Знакомства</title>
</head><body>
<div class="header"><img src="' . $GLOBALS['config']['site']['home'] .'images/logo.gif" alt="LoGo" /></div>
<div class="nav">
<a href="' . $GLOBALS['config']['site']['home'] .'users.php">Юзеры</a> | <a href="' . $GLOBALS['config']['site']['home'] .'">Главная</a>';
if ( $GLOBALS['is_logged'] && $GLOBALS['user_data']['level'] == 100 ) {
$html .= ' | <a href="' . $GLOBALS['config']['site']['home'] .'admin/admin.php">Админка</a>';
}
$html .= '</div>';
// Есть сообщение!
if ( $GLOBALS['is_logged'] ) {
$new_mess = mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `mail_for` = '" . $GLOBALS['user_data']['login'] . "' AND `status` = '1' "), 0);
if ( $new_mess > 0 ) {
$html .= '<div class="menu">
<a href="' . $GLOBALS['config']['site']['home'] .'mail.php"><font color="red"><b>Вам почта: ' . $new_mess . '</b></font></a>
</div>';
}
}
return $html;
}
// Шаблон низа страницы
function foot() {
// Количество онлайн
$online = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `online_time` + 60 > {$_SERVER['REQUEST_TIME']} "), 0);
$down = '<div class="rekl">Общаются: <b>' . $online . '</b></div>
<div class="footer">Спасибо НЕЗНАЙКЕ</div>
</body>
</html>';
return $down;
}
function rand_letter($num) {
$array = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
$string = '';
for($i=0; $i < $num; $i++) $string .= $array[array_rand($array)];
return $string;
}