Файл: vsime.com/dating/inc/act_index.php
Строк: 151
<?
ex_head();
if (isset($_GET['delete']) && isset($_SESSION['dating_data'])) {
unset($_SESSION['dating_data']);
header("Location: /dating");
exit();
}
$where = NULL;
if (isset($_GET['search'])) {
$pol = my_esc(@$_GET['pol']);
if (in_array($pol, array('all', '0', '1')))$pol = $pol;
else $pol = 'all';
$age_from = my_esc(intval(@$_GET['age_from']));
$age_to = my_esc(intval(@$_GET['age_to']));
$age_from_q = date("Y") - $age_from;
$age_to_q = date("Y") - $age_to;
$pol_type = my_esc(@$_GET['pol_type']);
$getting_target = my_esc(@$_GET['getting_target']);
if (in_array($getting_target, array('friendly_and_talking', 'flirt', 'love', 'family', 'virt_sex', 'sponsor', 'i_sponsor')))$getting_target = $getting_target;
else $getting_target = 'all';
if (in_array($pol_type, array('getero', 'gl', 'bi')))$pol_type = $pol_type;
else $pol_type = 'all';
$avatar = my_esc(intval(@$_GET['avatar']));
$where = " WHERE ";
if ($avatar == 1)$where .= " `user`.`avatar` != '0'"; else $where .= " (`user`.`avatar` != '0' OR `user`.`avatar` = '0')";
if ($pol == 'all')$where .= ""; elseif (in_array($pol, array(0, 1)))$where .= " AND `anketa`.`pol` = '".intval($pol)."'";
if ($age_from_q != date("Y") || $age_from_q != date("Y"))$where .= " AND `anketa`.`g_r` > '$age_to_q' AND `anketa`.`g_r` < '$age_from_q'";
if (in_array($pol_type, array('getero', 'gl', 'bi')))$where .= " AND `anketa`.`pol_type` = '$pol_type'";
if (in_array($getting_target, array('friendly_and_talking', 'flirt', 'love', 'family', 'virt_sex', 'sponsor', 'i_sponsor')))$where .= " AND `anketa`.`$getting_target` = '1'";
$search_act = 1;
}
//echo $where;
echo "<div class='grand_h'>n";
echo "<img src='/i/site/search.png' /> <a href='?act=search'>Поиск</a>n";
echo "</div>n";
echo "<div class='main'>n";
if (isset($_SESSION['dating_data'])) {
if (isset($_SESSION['dating_data']['country'])) {
$country = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `country` WHERE `id` = '".intval($_SESSION['dating_data']['country'])."'"));
$where .= (!$where?" WHERE ":" AND ")."`country` = '$country[id]'";
echo "<img src='/i/flags/$country[ico].gif' /> <a href='/selector/?act=location&select_for=dating&uid=$user[id]&mdp=$mdp'>".hsc($country['name'])."</a>n";
if (isset($_SESSION['dating_data']['city'])) {
$city = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `city` WHERE `id` = '".intval($_SESSION['dating_data']['city'])."'"));
$where .= " AND `city` = '$city[id]'";
echo " > <a href='/selector/?act=location&select_for=dating&sec=country&id=$country[id]&uid=$user[id]&mdp=$mdp'>".hsc($city['name'])."</a>n";
} else echo " > <a href='/selector/?act=location&select_for=dating&sec=country&id=$country[id]&uid=$user[id]&mdp=$mdp'>Выбрать город</a>n";
} else echo "<a href='/selector/?act=location&select_for=dating&uid=$user[id]&mdp=$mdp'>Выбрать страну</a>n";
echo " <a href='/dating/?delete=1".(isset($search_act)?"&search=1&pol=$pol&pol_type=$pol_type&getting_target=$getting_target&avatar=$avatar&age_from=".intval($age_from)."&age_to=".intval($age_to)."&":NULL)."'>$config[code_delete]</a>n";
} else echo "<a href='/selector/?act=location&select_for=dating&uid=$user[id]&mdp=$mdp'>Выбрать страну</a>n";
echo "</div>n";
$count_results = mysqli_result("SELECT COUNT(*) FROM `anketa` INNER JOIN `user` ON `anketa`.`id_user` = `user`.`id`$where");
$count_pages = navi :: count_pages($count_results);
$page = navi :: page();
$start = navi :: start_pages();
if (!$count_results) {
echo "<div class='list_empty'>n";
echo "Пусто :(n";
echo "</div>n";
}
$city2 = array();
$query = mysqli_query($dbi, "SELECT * FROM `anketa` INNER JOIN `user` ON `anketa`.`id_user` = `user`.`id`$where ORDER BY `user`.`id` DESC LIMIT $start, $config[rop]");
while ($anketa = mysqli_fetch_array($query)) {
//print_r($anketa);
if ($anketa['city'])$city2[$anketa['id']] = mysqli_fetch_array(mysqli_query($dbi, "SELECT * FROM `city` WHERE `id` = '$anketa[city]'"));
$ank = profile($anketa['id_user']);
echo "<div class='list'>n";
echo "<div class='left'>n";
show_avatar($ank['id'], 'small', 1);
echo "</div>n";
echo "<div class='overfl_hid'>n";
echo profile_icon($ank['id']).profile_nick($ank['id'], 1);
if ($ank['anketa']['age'])echo ", ".sklon_text($ank['anketa']['age'], array('год', 'года', 'лет'));
echo "<br />n";
if (isset($city2[$anketa['id']]))echo "<span class='grey'>".hsc($city2[$anketa['id']]['name'])."</span><br />n";
if ($anketa['o_sebe'])echo hsc($anketa['o_sebe'])."n";
echo "</div>n";
echo "<div class='clear'></div>n";
echo "</div>n";
}
navi :: pages_show("?".(isset($search_act)?"search=1&pol=$pol&pol_type=$pol_type&getting_target=$getting_target&avatar=$avatar&age_from=".intval($age_from)."&age_to=".intval($age_to)."&":NULL));
if (isset($search_act)) {
echo "<div class='mod_grad'>n";
echo imgsd('dating.png')." <a href='?act=search'>Новый поиск</a>n";
echo "</div>n";
}
ex_foot();
?>