Файл: love/search.php
Строк: 361
<?php // автор -=ШАХТЕР=- http://waphp.ru
require'../includes.php';
$align='left';
$title='Знакомства|Поиск';
aut();
head();
who_add(0,'love');
echo '<br />';
switch($mod){
default:
break;
case 'nick':
if (empty($act)){
if ($ver!='wml')echo '<form action="search?mod='.$mod.'&act=search&'.SID.'" method="post">';
echo 'Кого ищем?:<br /><input type="text" name="nick" title="Text"/><br/>';
echo 'Искать по:<br/>
<select name="mode">
<option value="nick">Нику/ID</option>
<option value="name">Имени</option>
<option value="surname">Фамилии</option>
<option value="school">Школе</option>
<option value="val">Месту работы</option>
<option value="info">О себе</option>
<option value="year">Год рождения</option>
</select><br/><br />';
if ($ver=='wml'){
echo '<anchor title="go">Искать<go href="search?mod='.$mod.'&act=search&'.SID.'" method="post">';
echo '<postfield name="nick" value="$nick"/>
<postfield name="mode" value="$mode"/>
</go></anchor><br />';
;
}else{
echo '<input type="submit" class="ibutton" value="Искать"/></form><br /><br />';
}
}else{
$nick = check($_POST['nick']);
$mode = check($_POST['mode']);
if (empty($v_us['max'])) $v_us['max']=10;
$max = $v_us['max'];
if ($mode==nick) {
if (!ctype_digit($nick)) {
$ruser = rus_to_k($nick);
$k_post=mysql_result(query("select count(*) as num from users WHERE love_city!='0' and love!='0' and ruser = '".$ruser."'"),0);
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;
$r = query ("Select * from users WHERE love_city!='0' and love!='0' and ruser = '".$ruser."' order by id LIMIT $start, $max");
} else {
$k_post=mysql_result(query("select count(*) as num from users WHERE love_city!='0' and love!='0' and id = '".$nick."'"),0);
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;
$r = query ("Select * from users WHERE love_city!='0' and love!='0' and id = '".$nick."' order by id LIMIT $start, $max");
}
}else{
$k_post=mysql_result(query("select count(*) as num from users WHERE love_city!='0' and love!='0' and `".$mode."` LIKE '%$nick%'"),0);
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;
$r = query ("Select * from users WHERE love_city!='0' and love!='0' and `".$mode."` LIKE '%$nick%' order by id LIMIT $start, $max");
}
if ($k_post == 0)echo 'Совпадений не нйдено...<br />';
$post_k=$start+1;
if ($k_post != 0)echo 'Найдено: '.$k_post.'';
echo "<dt></dt><br />";
while($a = @mysql_fetch_assoc($r)){
if ($a['mvozrast'] == 21 || $a['mvozrast'] == 31 || $a['mvozrast'] == 41 || $a['mvozrast'] == 51 || $a['mvozrast'] == 61)$years = 'год';
else if ($a['mvozrast'] == 22 || $a['mvozrast'] == 23 || $a['mvozrast'] == 24 || $a['mvozrast'] == 32 || $a['mvozrast'] == 33 || $a['mvozrast'] == 34 || $a['mvozrast'] == 42 or $a['mvozrast'] == 43 || $a['mvozrast'] == 44 || $a['mvozrast'] == 52 || $a['mvozrast'] == 53 || $a['mvozrast'] == 54 || $a['mvozrast'] == 62 || $a['mvozrast'] == 63 || $a['mvozrast'] == 64|| $a['mvozrast'] == 2)$years = 'года';
else $years = 'лет';
echo links.''.nik_love($a['id']).' ['.$a['mvozrast'].' '.$years.']|<a href="messages?mod=msg&nk='.$a['id'].'">[написать]</a>|<a href="index?mod=bookmarks&nk='.$a['id'].'">[в закладки]</a>'.div;
echo 'Город: '.cities($a['love_city'],1).' ('.cities($a['love_country'],3).', '.cities($a['love_region'],2).')';
echo '<dl></dl>';
}
if ($k_page>1){
echo "<dl><dt></dt></dl>";
str('?mod='.$mod.'&act=act&',$k_page,$page); // Вывод страниц
echo "<br /><dl><dt></dt></dl><br />";
}
echo '<a href="?mod='.$mod.'">Новый поиск</a><br />';
}
break;
case 'love':
if (empty($act)){
if ($ver!='wml')echo '<form action="search?'.SID.'" method="get">';
echo '<input name="mod" type="hidden" value="'.$mod.'">
<input name="act" type="hidden" value="act">';
/*echo 'Я:<br /><select name="ya">';
if($v_us['sex2'] == 0)$sel0 = 'selected="selected"';
if($v_us['sex2'] == 1)$sel1 = 'selected="selected"';
if($v_us['sex2'] == 2)$sel2 = 'selected="selected"';
if($v_us['sex2'] == 3)$sel3 = 'selected="selected"';
if($v_us['sex2'] == 4)$sel4 = 'selected="selected"';
echo '
<option value="0" '.$sel0.'>Девушка</option>
<option value="1" '.$sel1.'>Парнь</option>
<option value="2" '.$sel2.'>Пара М+Ж</option>
<option value="3" '.$sel3.'>Пара М+М</option>
<option value="4" '.$sel4.'>Пара Ж+Ж</option>
</select><br/>';*/
if($v_us['poznak'] == 0)$sel10 = 'selected="selected"';else $sel10 = false;//Режим отладки
if($v_us['poznak'] == 1)$sel11 = 'selected="selected"';else $sel11 = false;
if($v_us['poznak'] == 2)$sel12 = 'selected="selected"';else $sel12 = false;
if($v_us['poznak'] == 3)$sel13 = 'selected="selected"';else $sel13 = false;
if($v_us['poznak'] == 4)$sel14 = 'selected="selected"';else $sel14 = false;
if($v_us['poznak'] == 5)$sel15 = 'selected="selected"';else $sel15 = false;
echo '<dl></dl>Xочу найти:<br/>
<select name="sear">
<option value="0" '.$sel10.'>Девушку</option>
<option value="1" '.$sel11.'>Парня</option>
<option value="2" '.$sel12.'>Пару М+Ж</option>
<option value="3" '.$sel13.'>Пару М+М</option>
<option value="4" '.$sel14.'>Пару Ж+Ж</option>
<option value="5" '.$sel15.'>Всех</option>
</select><br />';
echo '<dl></dl>Город:<br />';
echo '<select name="city">';
$city=explode('-',check($_GET['city']));
if(isset($_GET['city']))echo '<option value="'.check($_GET['city']).'">'.cities($city[0],3).','.cities($city[2],1).'</option>';
echo '<option value="0-0-0">Любой город</option>
<option value="'.cities($v_us['love_country'],3,1).'-0-0">'.cities($v_us['love_country'],3).'</option>
<option value="'.cities($v_us['love_country'],3,1).'-'.cities($v_us['love_region'],2,1).'-0">'.cities($v_us['love_country'],3).','.cities($v_us['love_region'],2).'</option>
<option value="'.cities($v_us['love_country'],3,1).'-'.cities($v_us['love_region'],2,1).'-'.cities($v_us['love_city'],1,1).'">'.cities($v_us['love_country'],3).','.cities($v_us['love_city'],1).'</option>';
echo '</select><br />';
echo '<a href="?mod=city">Выбрать другой Город</a><br />';
if($v_us['vozrast'] == 1)$vozrast = 20;
if($v_us['vozrast'] == 2)$vozrast = 25;
if($v_us['vozrast'] == 3)$vozrast = 30;
if($v_us['vozrast'] == 4)$vozrast = 35;
if($v_us['vozrast'] == 5)$vozrast = 40;
if($v_us['vozrast'] == 6)$vozrast = 50;
if($v_us['vozrast'] == 7)$vozrast = 60;
echo '<dl></dl>Возраст:<br />';
echo '<input size="2" name="v_ot" maxlength="3" value="15" title="От"/> — <input size="2" name="v_do" maxlength="3" value="'.$vozrast.'" title="До"/> лет<br />';
echo '<dl></dl>Цель знакомства:<br/>
<input type="checkbox" name="cel_znak1" value="1" checked="checked"/>Общение<br/>
<input type="checkbox" name="cel_znak2" value="1" checked="checked"/>Дружба<br/>
<input type="checkbox" name="cel_znak3" value="1" checked="checked"/>Любовь<br/>
<input type="checkbox" name="cel_znak4" value="1"/>Секс<br/>
<input type="checkbox" name="cel_znak5" value="1"/>Брак<br/>
<input type="checkbox" name="cel_znak6" value="1"/>Другое<br/>';
echo '<dl></dl><input type="checkbox" name="foto" value="1"/>Только с фото<br /><input type="checkbox" name="onl" value="1"/>Только онлайн<br/>';
echo '<dl></dl>Сортировка:<br/>
<select name="sort">
<option value="0">Все</option>
<option value="1">По времени захода</option>
<option value="2">По возрасту</option>
<option value="3">По городу</option>
</select><br/>';
if ($ver=='wml'){
echo '<br /><anchor title="go">Искать<go href="search?mod='.$mod.'&act=search&'.SID.'" method="get">';
echo '<postfield name="sear" value="$sear"/>
<postfield name="city" value="$city"/>
<postfield name="v_ot" value="$v_ot"/>
<postfield name="v_do" value="$v_do"/>
<postfield name="cel_znak1" value="$cel_znak1"/>
<postfield name="cel_znak2" value="$cel_znak2"/>
<postfield name="cel_znak3" value="$cel_znak3"/>
<postfield name="cel_znak4" value="$cel_znak4"/>
<postfield name="cel_znak5" value="$cel_znak5"/>
<postfield name="cel_znak6" value="$cel_znak6"/>
<postfield name="foto" value="$foto"/>
<postfield name="onl" value="$onl"/>
<postfield name="sort" value="$sort"/>
</go></anchor><br />';
;
}else{
echo '<br /><input type="submit" class="ibutton" value="Искать"/></form><br /><br />';
}
}else{
$sear = check(intval($_REQUEST['sear']));
$city = check($_REQUEST['city']);
$v_ot = check(intval($_REQUEST['v_ot']));
$v_do = check(intval($_REQUEST['v_do']));
$cel_znak1 = check(intval($_REQUEST['cel_znak1']));
$cel_znak2 = check(intval($_REQUEST['cel_znak2']));
$cel_znak3 = check(intval($_REQUEST['cel_znak3']));
$cel_znak4 = check(intval($_REQUEST['cel_znak4']));
$cel_znak5 = check(intval($_REQUEST['cel_znak5']));
$cel_znak6 = check(intval($_REQUEST['cel_znak6']));
$foto = check(intval($_REQUEST['foto']));
$onl = check(intval($_REQUEST['onl']));
$sort = check(intval($_REQUEST['sort']));
if($sear!=5){$sear2 = "and `sex2` = '".$sear."'"; }
$citys=explode('-',$city);
if($citys[0]!=0){$sc = " and `love_country` = '".$citys[0]."'";}
if($citys[1]!=0){$sr = " and `love_region` = '".$citys[1]."'";}
if($citys[2]!=0){$ss = " and `love_city` = '".$citys[2]."'";}
if($v_ot>0)$vot = " and `mvozrast` >= '".$v_ot."'";
if($v_do>0)$vdo = " and `mvozrast` <= '".$v_do."'";
$cz.= " and (`cel` > '10'";
if($cel_znak1==1)$cz.= " or `cel` = '0'";
if($cel_znak2==1)$cz.= " or `cel` = '1'";
if($cel_znak3==1)$cz.= " or `cel` = '2'";
if($cel_znak4==1)$cz.= " or `cel` = '3'";
if($cel_znak5==1)$cz.= " or `cel` = '4'";
if($cel_znak6==1)$cz.= " or `cel` = '5'";
$cz.= ")";
if($foto==1)$ft = " and `love_photo` != ''";
if($onl==1)$ft = " and `onl` >= '".($time - $set['time_aut'])."'";
/*<option value="0">Все</option>
<option value="1">По времени захода</option>
<option value="2">По возрасту</option>
<option value="3">По городу</option>*/// Надо доделать
if($sort==0)$srt = 'id';
elseif($sort==1)$srt = 'onl desc';
elseif($sort==2)$srt = 'vozrast desc';
elseif($sort==3)$srt = 'love_city desc';
$max = $v_us['max'];
$k_post=mysql_result(query("select count(*) as num from users WHERE love_city!='0' and love!='0' ".$sear2.$sc.$sr.$ss.$vot.$vdo.$cz.$ft.";"),0);
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;
$r = query ("Select * from users WHERE love_city!='0' and love!='0' ".$sear2.$sc.$sr.$ss.$vot.$vdo.$cz.$ft." order by ".$srt." LIMIT $start, $max");
if ($k_post == 0)echo 'Совпадений не нйдено...<br />';
$post_k=$start+1;
if ($k_post != 0){
if (($max*$page)<$k_post) $maxi = $max*$page; else $maxi = $k_post;
echo 'Показаны '.($start+1).'-'.$maxi.' из '.$k_post.'<br />';
echo "<br />";}
while($a = @mysql_fetch_assoc($r)){
if ($a['mvozrast'] == 21 || $a['mvozrast'] == 31 || $a['mvozrast'] == 41 || $a['mvozrast'] == 51 || $a['mvozrast'] == 61)$years = 'год';
else if ($a['mvozrast'] == 22 || $a['mvozrast'] == 23 || $a['mvozrast'] == 24 || $a['mvozrast'] == 32 || $a['mvozrast'] == 33 || $a['mvozrast'] == 34 || $a['mvozrast'] == 42 or $a['mvozrast'] == 43 || $a['mvozrast'] == 44 || $a['mvozrast'] == 52 || $a['mvozrast'] == 53 || $a['mvozrast'] == 54 || $a['mvozrast'] == 62 || $a['mvozrast'] == 63 || $a['mvozrast'] == 64|| $a['mvozrast'] == 2)$years = 'года';
else $years = 'лет';
echo links.''.nik_love($a['id']).' ['.$a['mvozrast'].' '.$years.']|<a href="messages?mod=msg&nk='.$a['id'].'">[написать]</a>|<a href="index?mod=bookmarks&nk='.$a['id'].'">[в закладки]</a>'.div;
echo 'Город: '.cities($a['love_city'],1).' ('.cities($a['love_country'],3).', '.cities($a['love_region'],2).')';
echo '<dl></dl>';
}
if ($k_page>1){
echo "<dl><dt></dt></dl>";
str("?mod=$mod&act=act&sear=$sear&city=$city&v_ot=$v_ot&v_do=$v_do&cel_znak1=$cel_znak1&cel_znak2=$cel_znak2&cel_znak3=$cel_znak3&cel_znak4=$cel_znak4&cel_znak5=$cel_znak5&cel_znak6=$cel_znak6&foto=$foto&onl=$onl&sort=$sort&",$k_page,$page); // Вывод страниц
echo "<br /><dl><dt></dt></dl><br />";
}
echo '<a href="?mod='.$mod.'">Новый поиск</a><br />';
}
break;
case 'city':
if (!empty($act)){
if (isset($_SESSION['search']))$search=$_SESSION['search'];
if (isset($_POST['search']))$search=$_POST['search'];
$_SESSION['search']=$search;
$k_post=mysql_result(query("select count(*) as num from cities WHERE `city_rus` LIKE '$search%'"),0);
$k_page=k_page($k_post,$max);
$page=page($k_page);
$start=$max*$page-$max;
if($k_post == 0)echo 'Ничего не найдено<br />';
$q = query ("Select * from cities WHERE `city_rus` LIKE '$search%' LIMIT $start, $max");
while($a = mysql_fetch_array($q))
{
$a2 = mysql_fetch_array(query("select * from `regions` WHERE `region_id` = '$a[region_id]'"));
echo '<a href="?mod='.$mod.'&country='.cities($a2['country_id'],3,1).'&region='.$a['region_id'].'&city='.$a['city_id'].'">'.$a['city_rus'].' ('.cities($a2['country_id'],3).','.cities($a['region_id'],2).')</a><br />';
}
if ($k_page>1){
echo "<dl><dt></dt></dl>";
str('?mod='.$mod.'&act=search&',$k_page,$page); // Вывод страниц
echo "<br /><dl><dt></dt></dl><br />";
}
}else{
if (empty($_GET['country'])){
echo '<b>Выберите Страну:</b><br /><br />';
$max = 15;
$k_post = mysql_result(query("select count(*) from `country`"),0);
$k_page = k_page($k_post,$max);
$page = page($k_page);
$start = $max*$page-$max;
if($k_post == 0)echo 'Ничего не найдено<br />';
$q = query("select * from `country` limit $start, $max");
if ($page==1){
echo '<a href="?mod='.$mod.'&country=73">Россия (Russia)</a><br />';
echo '<a href="?mod='.$mod.'&country=92">Украина (Ukraine)</a><br />';
echo '<a href="?mod='.$mod.'&country=8">Беларусь (Belarus)</a><dl><dt></dt></dl>';
}
while($a = mysql_fetch_array($q))
{
echo '<a href="?mod='.$mod.'&country='.$a['country_id'].'">'.$a['country_rus'].' ('.$a['country_eng'].')</a><br />';
}
if ($k_page>1){
echo "<dl><dt></dt></dl>";
str("?mod=$mod&",$k_page,$page); // Вывод страниц
echo "<br /><dl><dt></dt></dl><br />";
}
}if (empty($_GET['region'])&&isset($_GET['country'])&&empty($_GET['city'])){
$country = check(intval($_GET['country']));
echo '<b>Выберите Регион:</b><br /><br />';
$max = 15;
$k_post = mysql_result(query("select count(*) from `regions` WHERE `country_id` = '$country'"),0);
$k_page = k_page($k_post,$max);
$page = page($k_page);
$start = $max*$page-$max;
if($k_post == 0)echo 'Ничего не найдено<br />';
$q = query("select * from `regions` WHERE `country_id` = '$country' limit $start, $max");
while($a = mysql_fetch_array($q))
{
echo '<a href="?mod='.$mod.'&country='.$a['country_id'].'&region='.$a['region_id'].'">'.$a['region_rus'].' ('.$a['region_eng'].')</a><br />';
}
if ($k_page>1){
echo "<dl><dt></dt></dl>";
str("?mod=$mod&country=$country&",$k_page,$page); // Вывод страниц
}
echo '<br /><dl><dt></dt></dl><br /><a href="?mod=$mod">Другая страна</a><br />';
}if (isset($_GET['region'])&&isset($_GET['country'])&&empty($_GET['city'])){
$country = check(intval($_GET['country']));
$region = check(intval($_GET['region']));
echo '<b>Выберите Город:</b><br /><br />';
$max = 15;
$k_post = mysql_result(query("select count(*) from `cities` WHERE `region_id` = '$region'"),0);
$k_page = k_page($k_post,$max);
$page = page($k_page);
$start = $max*$page-$max;
if($k_post == 0)echo 'Ничего не найдено<br />';
$q = query("select * from `cities` WHERE `region_id` = '$region' limit $start, $max");
while($a = mysql_fetch_array($q))
{
echo '<a href="?mod='.$mod.'&country='.$country.'&region='.$a['region_id'].'&city='.$a['city_id'].'">'.$a['city_rus'].' ('.$a['city_eng'].')</a><br />';
}
if ($k_page>1){
echo "<dl><dt></dt></dl>";
str("?mod=$mod&country=$country&region=$region&",$k_page,$page); // Вывод страниц
}
echo '<br /><dl><dt></dt></dl><br /><a href="?country='.$country.'">Другой регион</a><br />';
echo '<a href="?mod=$mod">Другая страна</a><br />';
}if (isset($_GET['region'])&&isset($_GET['country'])&&isset($_GET['city'])){
$city = check(intval($_GET['country'])).'-'.check(intval($_GET['region'])).'-'.check(intval($_GET['city']));
header ('Location: ?mod=love&city='.$city.SID); exit;
}
if ($ver!='wml')echo '<form action="?mod='.$mod.'&act=search&'.SID.'" method="post">';
echo 'Введите первые буквы или название города целиком:<br /><input type="text" name="search" title="Text"/><br/>';
if ($ver=='wml'){
echo '<anchor title="go">Искать<go href="search?mod='.$mod.'&act=search&'.SID.'" method="post">';
echo '<postfield name="search" value="$search"/>
</go></anchor><br />';
;
}else{
echo '<input type="submit" class="ibutton" value="Искать"/></form><br /><br />';
}
}
break;
}
echo '<br />';
echo gb.'<a href="index">Знакомства</a>'.div;
echo gb.'<a href="'.H.'enter">Чат</a>'.div;
foot(); // автор -=ШАХТЕР=- http://waphp.ru
?>