Размер файла: 6.06Kb
<?php
$mt=microtime();
require('db.php');
require('nast.php');
require('shapka.php');
@session_start();
$s=htmlspecialchars(session_id());
$ontime=time()-350;
print $beginpage;
if(!@$_SESSION['enter'])
{
print "Авторизация не удалась.<br />
Возможно вы ввели неверные логин или пароль, либо истекло время жизни сессии<br />
<a href=\"index.php?str=$str\">Повторить ввод</a><br />";
print $endpage;
exit;
}
else
{
$time=time();
$info=mysql_fetch_assoc(mysql_query("SELECT * from `user` WHERE `uid`='$_SESSION[uid]' limit 1"));
// print "SELECT * from `user` WHERE `uid`='$_SESSION[uid]' limit 1";
mysql_query("UPDATE `user` SET `ldate`='$time',`place`='1050' WHERE `uid`='$_SESSION[uid]' limit 1");
print "$vydel2 Поиск анкет<br />$vydel1";
if($str=='wml')
{
$forma='Пол:
<select name="sex">
<option value="0">М</option>
<option value="1">Ж</option>
<option value="2">Без разницы</option>
</select><br/>
Год рождения:<br />
От:<br />
<input name="year1" maxlength="4" title="year" size="4" format="*N" emptyok="false"/><br/>
До:<br />
<input name="year2" maxlength="4" title="year" size="4" format="*N" emptyok="false"/><br/>
Город:<br />
<input name="city" maxlength="20" title="city" emptyok="false"/><br/>
Email:<br />
<input name="mail" maxlength="20" title="city" emptyok="false"/><br/>
Искать только онлайн:
<select name="onl">
<option value="0">нет</option>
<option value="1">да</option>
</select><br/>
<anchor title="go">Найти<go href="search.php?ses='.$s.'&act=reg&str=wml" method="post">
<postfield name="name" value="$(name)"/>
<postfield name="sex" value="$(sex)"/>
<postfield name="year1" value="$(year1)"/>
<postfield name="year2" value="$(year2)"/>
<postfield name="ves1" value="$(ves1)"/>
<postfield name="ves2" value="$(ves2)"/>
<postfield name="rost1" value="$(rost1)"/>
<postfield name="rost2" value="$(rost2)"/>
<postfield name="city" value="$(city)"/>
<postfield name="mail" value="$(mail)"/>
<postfield name="onl" value="$(onl)"/>
</go></anchor><br/>
';
}
else
{
$forma='</div><form action="search.php?ses='.$s.'&act=reg&str=xhtml" method="post"><div>
Пол:
<select name="sex">
<option value="0">М</option>
<option value="1">Ж</option>
<option value="2">Без разницы</option>
</select><br/>
Год рождения:<br />
От:<br />
<input name="year1" maxlength="4" title="year" size="4" /><br/>
До:<br />
<input name="year2" maxlength="4" title="year" size="4" /><br/>
Город:<br />
<input name="city" maxlength="20" title="city"/><br/>
Email:<br />
<input name="mail" maxlength="20" title="city"/><br/>
Искать только онлайн::
<select name="onl">
<option value="0">нет</option>
<option value="1">да</option>
</select><br/>
<input class="ibutton" type="submit" value="Искать"/></div></form><div>
';
}
if(!@$_GET['act'])
{
print "1.Поиск по нику:<br />";
if($str=='wml')
{
$nocache=rand(1,1000);
echo "
Ник:<br/>
<input type=\"text\" name=\"login$nocache\" maxlength=\"300\" value=\"\"/><br/>
<anchor>[Искать]<go href=\"anketa.php?ses=$s&str=wml\" method=\"post\">
<postfield name=\"login\" value=\"$(login$nocache)\"/>
</go></anchor><br/>
2.расширенный поиск:<br />
";
}
else
{
print '</div><form action="anketa.php?str=xhtml&ses='.$s.'" method="post"><div>
Ник: <input name="login" maxlength="300" value="" title=""/><br/>
<input class="ibutton" type="submit" value="Искать"/></div></form><div>
2.расширенный поиск:<br />
';
}
print $forma;
}
else
{
$page=intval(@$_GET['page']);
if(isset($_GET['page']) and isset($_SESSION['search']))
{$result=mysql_query($_SESSION['search']); $count=mysql_num_rows($result);}
else
{
$year1=intval(@$_POST['year1']);
if($year1>2000 or $year1<1950)
{
$year1=0;
}
$year2=intval(@$_POST['year2']);
if($year2>2000 or $year2<1950)
{
$year2=2500;
}
$query="SELECT * from `user` WHERE `year`>=$year1 AND `year`<=$year2";
$sex=intval(@$_POST['sex']);
if((int)$sex===0 or $sex==1)
{
$query.=" AND `pol`='$sex' ";
}
$city=mysql_real_escape_string(@$_POST['city']);
if($city)
$query.=" AND `city`='$city'";
$mail=mysql_real_escape_string(@$_POST['mail']);
if($mail)
$query.=" AND `mail`='$mail'";
$onl=intval($_POST['onl']);
if($onl)
$query.=" AND `ldate`>$ontime";
$result=mysql_query($query);
$count=mysql_num_rows($result);
//print $query.'<br />';
if($count)
$_SESSION['search']=$query;
}
if($count)
print "Найдено: $count анкет<br />";
else
{
unset($_SESSION['search']);
print 'По вашему запросу ничего не найдено<br />';
}
$start=$page*$info['kolan'];
$end=$start+$info['kolan'];
@mysql_data_seek($result, $start);
while($user=mysql_fetch_assoc($result))
{
if($user['pol']!=1)
$pol='М';
else
$pol='Ж';
print "<a href=\"anketa.php?str=$str&ses=$s&login=$user[nick]\">$user[nick] ($pol, $user[year])</a><br />";
$start++;
if($start>=$end)
break;
}
print $razd;
if($end<$count)
print "<a href=\"search.php?str=$str&ses=$s&act=do&page=".($page+1)."\">далее</a><br />";
if($page>0)
print "<a href=\"search.php?str=$str&ses=$s&act=do&page=".($page-1)."\">назад</a><br />";
print "<a href=\"search.php?str=$str&ses=$s\">Новый поиск</a><br />";
}
print $razd."<a href=\"enter.php?str=$str&ses=$s\">Прихожая</a><br />";
}
print $endpage;
print '<!-- '.(microtime()-$mt).' -->';
?>