Файл: search.php
Строк: 213
<?
require_once("core/core.php");
require_once("core/ava_users.php");
$location = 'В знакомствах';
if (isset($_GET['submit'])) {
$sex = check(@$_GET['sex']);
$family = num(@$_GET['family']);
$orientation = num(@$_GET['orientation']);
$age1 = num(@$_GET['age1']);
$age2 = num(@$_GET['age2']);
$city = check(substr($_GET['city'], 0, 100));
$online = num(@$_GET['online']);
header("Location: search.php?act=go&sex=" . @$sex . "&age1=" . @$age1 . "&age2=" . @$age2 . "&city=" . @$city . "&family=" . @$family . "&orientation=" . @$orientation . "&online=" . @$online . "");
}
switch (@$_GET['act']) {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Результат ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
case 'go':
if ($u['setting_users_list'])
$count = $u['setting_users_list']; else
$count = 10;
$sex = check(@$_GET['sex']);
if ($sex == 'zh' || $sex == 'm')
$sexq = "AND `sex` = '" . $sex . "'"; else
$sexq = "";
$family = check(@$_GET['family']);
if ($family == '1' || $family == '2' || $family == '3' || $family == '4' || $family == '5' || $family == '6')
$familyq = "AND `family` = '" . $family . "'"; else
$familyq = "";
$orientation = check(@$_GET['orientation']);
if ($orientation == '1' || $orientation == '2' || $orientation == '3' || $orientation == '4')
$orientationq = "AND `orientation` = '" . $orientation . "'"; else
$orientationq = "";
$age1 = intval(@$_GET['age1']);
if ($age1 > 0 && $age1 < 90) {
$year = date('Y') - $age1 + 1;
$age1q = "AND `anketa_byear` > '0' AND `anketa_byear` < '" . $year . "'";
} else {
$age1q = "";
}
$age2 = intval(@$_GET['age2']);
if ($age2 > 0 && $age2 < 90) {
$year = date('Y') - $age2 - 1;
$age2q = "AND `anketa_byear` > '0' AND `anketa_byear` > '" . $year . "'";
} else {
$age2q = "";
}
$city = check(substr(@$_GET['city'], 0, 100));
if ($city)
$cityq = "AND `anketa_city` = '" . @$city . "'"; else
$cityq = "";
$online = intval(@$_GET['online']);
if ($online)
$onlineq = "AND `online` > '" . (time() - $system['online_time']) . "'"; else
$onlineq = "";
if ($sexq || $familyq || $orientationq || $age1q || $age2q || $cityq || $onlineq)
$where = "WHERE `id` > '0'"; else
$where = "";
$title = $title . ' :: Поиск людей';
include 'head.php';
echo '<div class="title"><center>';
echo '<a href = "search.php"> Знакомства</a> :: Поиск';
echo '</center></div>';
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `users` $where $sexq $familyq $orientationq $age1q $age2q $onlineq $cityq "), 0);
echo '<div class = "nav">Найдено: <b><font color="green">' . $all . '</font></b> пользователей</div>';
if ($all > 0) {
$total = intval(($all - 1) / $count) + 1;
$page = num(@$_GET['page']);
if (empty($page) or $page < 0)
$page = 1;
if ($page > $total)
$page = $total;
$start = $page * $count - $count;
$result = mysql_query("SELECT * FROM `users` $where $sexq $familyq $orientationq $age1q $age2q $onlineq $cityq ORDER BY rating DESC LIMIT $start, $count");
while ($user = mysql_fetch_assoc($result)) {
echo '<div class="div">';
echo '<table><tr><td VALIGN=top>';
ava($user['id'], 50);
echo '</td><td VALIGN=top>';
if ($user['delete'] == 1) {
echo '' . ico($user['sex'], $user['admin'], $user['online']) . '';
echo '<a href="/page.php?id=' . $user['id'] . '"> <b><font color="#79358c"><del>' . $user['login'] . '</del></font></b></a>';
echo '' . medal($user['rating']) . '';
} else {
echo '' . ico($user['sex'], $user['admin'], $user['online']) . '';
echo '<a href="/page.php?id=' . $user['id'] . '"> <b><font color="#79358c">' . $user['login'] . '</font></b></a>';
}
//~~~~~~~~~~~~~~~Высчитываю возвраст~~~~~~~~~~~~~~//
$e = date("Y");
$d = $user['anketa_byear'];
$qwe = $e - $d;
if ($qwe == $e) {
} else {
echo ", $qwe лет";
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
echo '<br /><font color="grey">' . $user['anketa_city'] . '</font>';
echo '<br />' . $user['anketa_about'] . '';
echo '<br/>';
echo '</table></div>';
}
navigation($page, $total, 'search.php?act=go&sex=' . @$sex . '&age1=' . @$age1 . '&age2=' . @$age2 . '&city=' . @$city . '&family=' . @$family . '&online=' . @$online . '&');
} else {
echo '<div class="div"> Пользователей не найдено!</div>';
}
echo '</div>';
include 'foot.php';
break;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Поля для поиска ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
default:
$title = $title . ' :: Знакомства';
include 'head.php';
require('core/ava_min.php');
echo '<div class="title"><center><b>Знакомства</b></center></div>';
if (@$_GET['search']) {
echo '<div class="div">';
echo '<form action="search.php" method=get>';
echo 'Пол: <br/><select name="sex">
<option value="0">- Не выбран -</option>
<option value="zh">Женский</option>
<option value="m">Мужской</option>
</select><br/>';
echo 'Семейное положение:<br/>
<select name="family">
<option value="0">- Семейное положение -</option>
<option value="1">Не женат/Не замужем</option>
<option value="2">Есть подруга/Есть друг</option>
<option value="3">Помолвлен/Помолвлена</option>
<option value="4">Женат/Замужем</option>
<option value="5">Всё сложно</option>
<option value="6">В активном поиске</option>
</select></br>';
echo 'Ориентация:<br/>
<select name="orientation">
<option value="0">- Ориентация -</option>
<option value="1">Гетеро</option>
<option value="2">Гей</option>
<option value="3">Лесби</option>
<option value="4">Би</option>
</select></br>';
echo 'Возраст: <br/> От: <input type=text SIZE=2 name=age1 maxlength=2> До: <input type=text SIZE=2 name=age2 maxlength=2><br/>';
echo 'Город: <br/><input type=text name=city maxlength=50><br/>';
echo '<input name="online" type="checkbox" value="1"> На сайте<br/>';
echo '<input type=submit name="submit" value="Найти" class="submit white"/></form>';
echo '</div>';
include 'foot.php';
exit;
}
echo '<div class="login">';
echo '<a href = "search.php?act=go&sex=zh"> Девушки</a> | </a>';
echo '<a href = "search.php?act=go&sex=m"> Парни</a> | </a>';
echo '<a href = "search.php?search=1">Поиск</a>';
echo '</center></div>';
if ($u['setting_users_list'])
$count = $u['setting_users_list']; else
$count = 10;
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `users`"), 0);
if ($all > 0) {
$total = intval(($all - 1) / $count) + 1;
$page = num(@$_GET['page']);
if (empty($page) or $page < 0)
$page = 1;
if ($page > $total)
$page = $total;
$start = $page * $count - $count;
$result = mysql_query("SELECT * FROM `users` ORDER BY `id` ASC LIMIT $start, $count");
while ($user = mysql_fetch_assoc($result)) {
echo '<div class="div">';
echo '<table><tr><td VALIGN=top>';
ava($user['id'], 50);
echo '</td><td VALIGN=top>';
if ($user['delete'] == 1) {
echo '' . ico($user['sex'], $user['admin'], $user['online']) . '';
echo '<a href="/page.php?id=' . $user['id'] . '"> <b><font color="#79358c"><del>' . $user['login'] . '</del></font></b></a>';
} else {
echo '' . ico($user['sex'], $user['admin'], $user['online']) . '';
echo '<a href="/page.php?id=' . $user['id'] . '"> <b><font color="#79358c">' . $user['login'] . '</font></b></a>';
echo '' . medal($user['rating']) . '';
}
//~~~~~~~~~~~~~~~Высчитываю возвраст~~~~~~~~~~~~~~//
$e = date("Y");
$d = $user['anketa_byear'];
$qwe = $e - $d;
if ($qwe == $e) {
} else {
echo ", $qwe лет";
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
echo '<br /><font color="grey">' . $user['anketa_city'] . '</font>';
echo '<br />' . $user['anketa_about'] . '';
echo '</table></div>';
}
echo '</div>';
navigation($page, $total, 'search.php?&');
} else {
echo '<div class="div"> Пользователей не найдено!</div>';
}
echo '</div>';
include 'foot.php';
break;
}
?>