<?
include 'config.php';
include 'func.php';
head();
aut();
ban();
////////////////////////////////////////
####################Запись онлайна##################
mysql_query("UPDATE `profile` SET `online` = 'search' WHERE `id` = '".$id_session."'");
####################################################

echo head . 'Поиск анкет' . div . katalog;

if(empty($_POST['id'])){

echo '<b>Точный поиск:</b><br />';
echo "Поиск по: <b>ID/Логин:</b><br/>\n";

echo "<form method=\"post\" action=\"search.php?mod=search\">\n";
echo "<input name=\"id\" maxlength=\"15\"/><br/>\n";
echo '<b>Поиск по:</b><br/>
<select name="po">
<option value="0">ID</option>
<option value="1">Логин</option>
</select><br/>';
echo "<input type=\"hidden\" name=\"action\" value=\"search\"/>";
echo "<input type=\"submit\" class=\"button\"  value=\"Искать\"/></form><br/>\n";

}else{


$po = num($_POST['po']);

if($po == 0)
{
$search_id = mysql_escape_string(html($_POST['id']));
$q = mysql_query("SELECT * FROM `profile` WHERE `id` = '".$search_id."';");
}else{
$search_login = mysql_escape_string(html($_POST['id']));
$q = mysql_query("SELECT * FROM `profile` WHERE `login` = '".$search_login."';");    
}


if(mysql_num_rows($q) == 0)
{
echo "Пользователь не найден в базе данных.<br/>\n";

}
else
{


$user = mysql_fetch_array($q);

$user_info = mysql_fetch_assoc(mysql_query("SELECT * FROM `profile` WHERE `id` = '".num($user['id'])."'"));
echo 'Найдена анкета: <b><a href="profile.php?id='.$user_info['id'].'">'.$user_info['login'].'</a></b><br/>';

}
}

echo '<br /><b>Расширенный поиск:</b><br />';
echo '<form action="search2.php" method="post" name="form">';
echo '<b>Ищу:</b><br/><select name="sex">
<option value="1">Парня</option>
<option value="0">Девушку</option>
</select><br/ ><br/ >';

echo '<b>В возрасте:</b><br/ >От: <input type="text" name="age1" maxlength="2" size="2"/> До: <input type="text" name="age2" maxlength="2" size="2"/><br/ ><br/ >';

echo '<b>Искать в городе:</b><br/>
<input type="text" name="city" value="'.$city_info['city_name'].'"maxlength="25" size="20"/>
<br/ ><br/ >';

echo '<input type="checkbox" name="online" value="1" /> Только онлайн<br/ >';


echo '<input name="submit" type="submit" class="button" value="Поиск" /></form>' . div;


/////////////////////////////////////////

navig();
foot();
?>