Файл: users.php
Строк: 64
<?php
include 'system/core.php';
include 'system/header.php';
if(!$user['id']){
header('Location: /index.php/?m=guest'); exit;
}
echo '<div class="tegi"><b>Список мастеров</b></div></div>';
echo '</div>';
echo '<div class="start">';
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
include 'modules/op/c.php';
include 'modules/privat/c.php';
echo '
<div class="men"><span>
<a href="/users.php?sort=0">По ID пользователя</a> | <a href="?sort=1">Новенькие</a></span>
</div> </div>
';
switch($_GET['m']){
default:
$cop = 10;
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `user`"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
$sort = trim($_GET['sort']);
if(empty($sort) or !is_numeric($sort) or $sort < 0 or $sort > 2){
$sort2 = 'id';
$sort = 0;
}elseif($sort == 1){
$sort2 = 'registration';
$desc = 'DESC';
}elseif($sort == 2){
$sort2 = 'rating';
$desc = 'DESC';
}
$users = mysql_query("SELECT * FROM `user` ORDER BY `$sort2` $desc LIMIT $start,$cop");
while($users2 = mysql_fetch_assoc($users)){
echo '<div class="post2">'.ustatus($users2['id']).' <a href="/us'.$users2['id'].'">'.uname($users2['id']).'</a> '.uaccess($users2['id']);
if(empty($sort)) echo ' (ID '.$users2['id'].')';
if($sort == 1) echo ' ('.times($users2['registration']).')';
elseif($sort == 2) echo ' ('.$users2['rating'].')';
echo '</div>';
}
echo '<div class="levo">Стр. ';
if($p-2>0) echo '<a href="/users.php?p=1"><<</a> ';
if($p-1>0) echo '<a href="/users.php?p='.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/users.php?p='.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/users.php?p='.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/users.php?p='.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/users.php?p='.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/users.php?p='.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/users.php?p='.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/users.php?p='.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/users.php?p='.ceil($ca/$cop).'">>></a>';
echo '</div><div class="s"> <div class="ss"><span> <a href="/users.php?m=search">Поиск мастера</a></span></div>';
echo '</div>';
break;
///////////////////////
case 'search':
if(isset($who)){
$type = TextGuard($type);
$who = TextGuard($who);
if(empty($who)) $err[] = 'ID или ник осталось пыстым';
if(!empty($who)) if($type == 1 && !is_numeric($who)) $err[] = 'В ID разрешено вводить только цифры';
if($type == 1){
$users = mysql_fetch_array(mysql_query('select * from `user` where `id` = "'.$who.'"'));
}else{
$users = mysql_fetch_array(mysql_query('select * from `user` where `login` = "'.$who.'"'));
}
if(!empty($who)) if($users == 0) $err[] = 'Такого пользователя не существует';
if($err){
echo '<div class="err"><b>';
foreach($err as $err_info){
echo $err_info.'<br>';
}
echo '</b></div>';
}else{
echo '<div class="post2">'.ustatus($users['id']).' <a href="/us'.$users['id'].'">'.uname($users['id']).'</a> '.uaccess($users['id']).'</div>';
}
}else{
echo '
<div class="post">
<form action="" method="post">
Тип поиска: </br><input type="radio" name="type" value="1" checked="checked" /> ID
<input type="radio" name="type" value="2" /> Ник<br/></br>Запрос:</br>
<input name="who"/><br><br>
<input type="submit" value="Искать"/>
</form></div>';
}
break;
/////////////////
}
include 'system/footer.php';
?>