View file love/search.php

File size: 6.02Kb
<?
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";
include_once"../template/isset.php";

$text = file("../local/profil/$log.prof");
if ($text!=""){
$udata = explode(":||:",$text[0]);
$provlog=trim($udata[0]);
$provpar=trim($udata[1]);
$privat=trim($udata[10]);}
//////////////////////////////////////////////////////////////////////////////////////
if (md5($_SESSION['par'])!==$provpar || $_SESSION['log']!==$provlog || $_SESSION['log']=="" || md5($_SESSION['par'])=="")
{header ("Location: index.php?".SID."");exit;}
if (!file_exists("../local/datalove/prof/$log.prof")){header ("Location: reg.php?".SID."");exit;}
//////////////////////////////////////////////////////////////////////////////////////

echo '<div class="tp"><img src="lovers.png" alt="" /> Поиск контакта</div><div class="body">';
$datalove=@file("../local/datalove/prof/$log.prof");
$datalove=explode(":||:", $datalove[0]);
$kont_str=$datalove[11]; // количество контактов на страницу
if ($kont_str=='' || $kont_str=='0'){$kont_str=7;}
if (isset ($_GET['act']) && $_GET['act']=='search')
{
if (isset ($_GET['page']) && $_GET['page']!='' && $_GET['page']!='0')
{
$page=intval($_GET['page']);
if ($page=='')
{$page='1';}
}
else
{$page='1';}

$s_pol=stripslashes(htmlspecialchars($_POST['pol']));
$s_gorod=stripslashes(htmlspecialchars($_POST['gorod']));
$s_orient=stripslashes(htmlspecialchars($_POST['orient']));
$s_age1=stripslashes(htmlspecialchars($_POST['age1']));
$s_age2=stripslashes(htmlspecialchars($_POST['age2']));
$s_foto=stripslashes(htmlspecialchars($_POST['foto']));
$s_online=stripslashes(htmlspecialchars($_POST['online']));
$s_gorod_n=stripslashes(htmlspecialchars($_POST['gorod_n']));
if (isset($_GET['pol']) && isset($_GET['gorod']) && isset($_GET['orient']) && isset($_GET['age1']) && isset($_GET['age2']) && isset($_GET['foto']) && isset($_GET['online']) && isset($_GET['gorod_n']))
{
$s_pol=stripslashes(htmlspecialchars($_GET['pol']));
$s_gorod=stripslashes(htmlspecialchars($_GET['gorod']));
$s_orient=stripslashes(htmlspecialchars($_GET['orient']));
$s_age1=stripslashes(htmlspecialchars($_GET['age1']));
$s_age2=stripslashes(htmlspecialchars($_GET['age2']));
$s_foto=stripslashes(htmlspecialchars($_GET['foto']));
$s_online=stripslashes(htmlspecialchars($_GET['online']));
$s_gorod_n=stripslashes(htmlspecialchars($_GET['gorod_n']));
}
$k_searched='0';
$search_o_d=opendir("../local/datalove/prof");

while ($search_r_d=readdir($search_o_d))
{
if (ereg(".prof$",$search_r_d))
{
$nick=str_replace(".prof","",$search_r_d);
$searched=file("../local/datalove/prof/$search_r_d");
$searched=explode(":||:",$searched[0]);
$searched_k=count($searched);
$vozrast=date("Y")-$searched[4];
if (date("n")<$searched[3]){$vozrast=$vozrast-1;}
elseif (date("n")==$searched[3]&& date("j")<$searched[2]){$vozrast=$vozrast-1;}
if ($s_pol==$searched[5] && $s_gorod==$searched[0] && $log!=$nick && $s_age1<=$vozrast && $s_age2>=$vozrast && $s_orient==$searched[6] || $s_pol==$searched[5] && $s_gorod_n=='on' && $s_age1<=$vozrast && $s_age2>=$vozrast && $s_orient==$searched[6] && $log!=$nick)
{
if ($s_foto=='on' && $searched[13]!='' && $searched[13]>'0' || $s_foto=='')
{
$online=file("../local/online.dat");
$online_k=count($online);
for ($z=0;$z<$online_k ;$z++ )
{
$on=explode("#",$online[$z]);
if ($nick==$on[2]){$onl='<font color="#00FF00">[On]</font>';}
}
if ($s_online=='' || $s_online=='on' && $onl!='')
{

$revvoz=strrev($vozrast);
switch($revvoz{0}){
case "1":
$vozpad="год";
break;
case "2":
$vozpad="года";
break;
case "3":
$vozpad="года";
break;
case "4":
$vozpad="года";
break;
default:
$vozpad="лет";
break;
}
if($vozrast > 10 & $vozrast < 15){$vozpad="лет";}
if ($k_searched>=$kont_str*$page-$kont_str && $k_searched<$kont_str*$page)
{
echo "<a href=\"kont.php?kont=$nick&amp;".SID."\">$searched[1] ($nick)</a>, $vozrast $vozpad";
echo " $onl<br />\r\n";
$onl='';
}
$k_searched++;
}
}
}
}
}
$page_k_okr=round($k_searched/$kont_str,0);
$page_k_tochn=$k_searched/$kont_str;
if ($page_k_okr==$page_k_tochn)
{
$page_k=$page_k_okr;
}
else
{
$page_k=$page_k_okr+1;
}
$page_p=$page-1;
$page_n=$page+1;
if ($k_searched=='0')
{echo "По вашему запросу ничего не найдено<br />\r\n<br />\r\n";}

echo "Страница: <b>$page</b> /$page_k<br />\r\n";
if ($page!='1' && $page>'0'){echo "<a href=\"search.php?act=search&amp;pol=$s_pol&amp;gorod=$s_gorod&amp;orient=$s_orient&amp;age1=$s_age1&amp;age2=$s_age2&amp;foto=$s_foto&amp;online=$s_online&amp;gorod_n=$s_gorod_n&amp;page=$page_p&amp;".SID."\" >&laquo;&laquo;&laquo;</a>";}
if ($page!='1' && $page>'0' && $page<$page_k){echo " || ";}
if ($page<$page_k){echo "<a href=\"search.php?act=search&amp;pol=$s_pol&amp;gorod=$s_gorod&amp;orient=$s_orient&amp;age1=$s_age1&amp;age2=$s_age2&amp;foto=$s_foto&amp;online=$s_online&amp;gorod_n=$s_gorod_n&amp;page=$page_n&amp;".SID."\" >&raquo;&raquo;&raquo;</a>";}
echo "<div class='panel'>\r\n";
echo "&raquo; <a href=\"search.php?".SID."\">Новый поиск</a><br />\r\n";
echo "&laquo; <a href=\"kab.php?".SID."\">Личный кабинет</a><br />\r\n";
echo "<div class='btm'>\r\n";
echo "<a href=\"index.php?".SID."\">На главную</a></div>\r\n";
include_once"../themes/$config_themes/foot.php";
exit;
}
include "search_form.php";
echo "<div class='panel'>\r\n&laquo; <a href=\"kab.php?".SID."\">Личный кабинет</a><br />\r\n";
echo "&laquo; <a href=\"index.php?".SID."\" >Главная</a></div>\r\n";
echo "<div class=btm>\r\n";
echo "<a href=\"../index.php?".SID."\">На главную</a></div>\r\n";
include_once"../themes/$config_themes/foot.php";
?>