Файл: my/poisk.php
Строк: 142
<?php
define('GCMS',true);
define('ROOT','../');
require_once (ROOT.'system/power.php');
if ($aut) {
///Главная
$diz -> head('Поиск');
$diz -> title('Поиск');
if (!isset($_POST['submit'])) {
$d = 1;
$day = '<option desabled>День</option>';
while ($d <= 31) {
$day .= '<option value="'.$d.'">'.$d.'</option>';
++$d;
}
$m = 1;
$month = '<option desabled>Месяц</option>';
function mes($mon) {
$mon = strtr($mon,array('1' => 'Январь','2' => 'Февраль', '3' => 'Март', '4' => 'Апрель', '5' => 'Май', '6' => 'Июнь',
'7' => 'Июль', '8' => 'Август', '9' => 'Сентябрь', '10' => 'Октябрь', '11' => 'Ноябрь', '12' => 'Декабрь'));
return $mon;
}
while ($m <= 12) {
$month .= '<option value="'.$m.'">'.mes($m).'</option>';
++$m;
}
$y=date('Y')-1;
$year = '<option desabled>Год</option>';
while ($y >=1960) {
$year .= '<option value="'.$y.'">'.$y.'</option>';
$y--;
}
echo '<div class="fon">
<form action="poisk.php" method="POST">
Ник:<br/><input type="text" name="login" maxlength="40"/><br/>
Имя:<br/><input type="text" name="name" maxlength="40"/><br/>
Фамилия:<br/><input type="text" name="fam" maxlength="40"/><br/>
Пол:<br/><select name="sex">
<option value="m">Мужской</option>
<option value="w">Женский</option></select><br/>
Дата рождения:<br/><select name="day">'.$day.'</select>
<select name="month">'.$month.'</select>
<select name="year">'.$year.'</select>';
if($nastr['geopos']==1)echo '<br/>Город:<br/><input type="text" name="city" maxlength="40"/>';
echo '<br/><input type="submit" name="submit" value="Найти"/></form></div>';
}else {
$login = shit($_POST['login']);
$name = shit($_POST['name']);
$fam = shit($_POST['fam']);
$city=shit($_POST['city']);
$sex = (isset($_POST['sex']) && ($_POST['sex'] == 'm' or $_POST['sex'] == 'w')) ? trim($_POST['sex']) : 'm';
$day = (!empty($_POST['day']) && $_POST['day'] > 0 && $_POST['day'] < 32) ? intval(abs((int)$_POST['day'])) : null;
$month = (!empty($_POST['month']) && $_POST['month'] > 0 && $_POST['month'] <= 12) ? intval(abs((int)$_POST['month'])) : null;
$year = (!empty($_POST['year']) && $_POST['year'] >= 1960 && $_POST['year'] <= date('Y')-1) ? intval(abs((int)$_POST['year'])) : null;
$sq=null;
if(mb_strlen($func->delprobel($login))>1)$zap_name='and `login`="'.$login.'"';
if(mb_strlen($func->delprobel($name))>1)$zap_name='and `name`="'.$name.'"';
if(mb_strlen($func->delprobel($fam))>1)$zap_fam='and `fami`="'.$fam.'"';
if($day>0)$zap_day='and `day`="'.$day.'"';
if($month>0)$zap_month='and `month`="'.$month.'"';
if($year>0)$zap_year='and `year`="'.$year.'"';
if($nastr['geopos']==1){if(mb_strlen($func->delprobel($city))>1 and $func->cityname($city)>0)$zap_city='and `city`="'.$func->cityname($city).'"';}
$count = $db -> dbcount('COUNT(`id`)','users','`sex`="'.$sex.'" '.$zap_name.' '.$zap_fam.' '.$zap_day.' '.$zap_month.' '.$zap_year.' '.$zap_city.'');
if($count>0){
//////////////////////////////////
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
///////////////////////////
$sql = $db -> query('SELECT `id` FROM `users` where `sex`="'.$sex.'" '.$zap_name.' '.$zap_fam.' '.$zap_day.' '.$zap_month.' '.$zap_year.' '.$zap_city.' ORDER BY `id` LIMIT '.$start.','.$num);
while ($users = $sql -> fetch_assoc()) {
echo '<div class="menu"/><a href="/id'.$users['id'].'" class="menutuch"/>
<table border="0" width="100%"><tr valign="top">
<td height="0" width="26">'.$func->avatar($users['id']).'</td>
<td>'. $func -> famname($users['id'],0).'<br/>
'. $func -> online($users['id']).'
</td></tr></table></a></div>';
}
$act = 'friends.php?';
$msg .= $func -> pagenav($act,$page,$total);
}else echo '<div class="fon"/>Поиск не дал результатов</div>';
echo '<div class="levo"><a href="?" class="levo_tuch">'.$diz -> img('back.png').' Назад</a></div>';
}
echo '<div class="levo"><a href="./" class="levo_tuch">'.$diz -> img('back.png').' Личный кабинет</a></div>';
echo '<div class="levo"><a href="/index.php" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
} else header('location: /aut.php');
?>