Файл: profiwm.pp.ua/search.php
Строк: 31
<?php
require 'system/sid.php';
require 'system/config.php';
include 'system/user.php';
include 'system/head.php';
include 'system/navigator.php';
whorm(0, 'search');
$do = isset($_GET['do']) ? $_GET['do'] : NULL;
switch($do) {
default:
if (isset($_SESSION['sS'])) unset($_SESSION['sS']);
if (isset($_SESSION['wW'])) unset($_SESSION['wW']);
echo $div_title . 'Поиск пользователя' . $div_end;
echo '<form method="post" action="?do=result">
<input type="search" name="s" placeholder="Ник, ID или WMID"/>
<br/>
<input type="radio" name="w" checked value="1"/> по нику
<br/>
<input type="radio" name="w" value="2"/> по id
<br/>
<input type="radio" name="w" value="3"/> по wmid
<br/>
<input type="submit" name="ok" value="Искать"/>
</form>';
break;
case result:
echo $div_title . 'Результаты поиска' . $div_end;
$s = my_check($_POST['s']);
$w = my_int($_POST['w']);
if (!isset($_SESSION['sS'])) $_SESSION['sS'] = $s;
if (!isset($_SESSION['wW'])) $_SESSION['wW'] = $w;
$str = ($_SESSION['wW'] == 1 ? "user LIKE '%$_SESSION[sS]%'" : ($_SESSION['wW'] == 2 ? "id = '$_SESSION[sS]'" : "wmid = '$_SESSION[sS]'"));
echo 'Вы искали: <b>' . $_SESSION['sS'] . '</b> ' . ($_SESSION['wW'] == 1 ? 'по нику' : ($_SESSION['wW'] == 2 ? 'по id' : 'wmid')) . '<br/>';
$Search = mysql_result(mysql_query("SELECT COUNT(id) FROM users WHERE $str"), 0);
if ($Search != 0)
{
$n = new navigator($Search, 10, '?do=result&');
$res = mysql_query("SELECT id FROM users WHERE $str ORDER BY id DESC {$n->limit}");
while($a = mysql_fetch_assoc($res))
{
echo us($a['id']) . '<br/>';
}
echo $n->navi();
} else {
if (isset($_SESSION['sS'])) unset($_SESSION['sS']);
if (isset($_SESSION['wW'])) unset($_SESSION['wW']);
echo 'Результат: не найдено.<br/>';
}
echo '<a href="search.php">Новый поиск</a><br/>';
break;
}
include 'system/foot.php';
?>