<?php

require '../system/start.php';
require '../system/functions.php';
$str['mesto'] = 'Поиск';
$str['block'] = $set['site'].' / Пользователи / Поиск';
include '../style/'.$style.'/head.php';
echo '<div class="mess"><strong>Введите логин пользователя или его часть (не меньше 3-х символов)</strong>:<br /><form action="usersearch.php" method="post"><div><input name="login" type="text" value=""/>
<input type="submit" value="Поиск"/></div></form></div>';
$users = mysql_query("select * from `users` where `login` LIKE '%".protect($_POST['login'])."%' order by `id` limit ".$page.",".$set['str']."");
$total = mysql_result(mysql_query("select count(*) from `users` where `login` LIKE '%".protect($_POST['login'])."%'"),0);
echo '<div class="mess">Найдено <strong>'.$total.'</strong> совпадений</div>';
if($total > 0)
{
while($row = mysql_fetch_assoc($users))
{
	$i++;
	if($i%2)
	{
		echo '<div class="forum1"><div class="row4">';
	} else
	{
		echo '<div class="forum2"><div class="row4">';
	}
	if(empty($row['foto']))
	{
		echo '<img src="../style/'.$style.'/'.$row['gender'].'.png"  width="60" height="60" align="left" alt="" style="margin-right:4px;border-right:1px solid #99ccff"/>';
    }
    elseif(!empty($row['foto']))
	{
		echo '<img src="../files/avatars/'.$row['foto'].'"  width="60" height="60" align="left" alt="" style="margin-right:4px;border-right:1px solid #99ccff"/>';
    }
	echo '<a href="../p/'.$row['login'].'">'.$row['login'].'</a>';
	echo status($row['id']);
	echo '<div class="ftext">
	Имя: '.$row['name'].'<br/>
	Рейтинг: '.$row['rate'].'<br/>
	Последний вход: '.clock($row['time']).'<br/>
	Зарегистрирован: '.clock($row['reg_time']).'
	</div>
	<div class="clear"></div>
	</div>
	</div>';
}
}
if($total > $set['str'])
{
	pages($page, $total, 'usersearch.php?', $set['str']);
}
include '../style/'.$style.'/foot.php';
?>