<?php
error_reporting(0);
//----------
include ('../inc/config.inc.php.php');
//----------
session_name('sid');
session_start();
//----------
connect_to_db();
include ('../inc/autorize.php.php');
include ('../inc/online.php.php');
include ('../inc/pages.php.php');
//----------
if ($autorize == 0 && $autorize['gladmin'] != 1) {
header('Location: ../index.php?partner='.$partner.'&mod='.$mod.'&'.$srand.'='.$r_rand);
exit();
}
// Поддержка
$sql = mysql_query("SELECT COUNT(`id`) FROM `love_support`;");
$support = mysql_result($sql, 0);
//----------
$partner = intval($_GET['partner']); if ($partner == 0) $partner = 1;
//----------
$arr = mysql_query("SELECT COUNT(*) FROM `love_partner`;");
$part_users = mysql_result($arr, 0);
if($partner > $part_users) $partner = 1;
//----------
$partner_arr = @mysql_query("SELECT * FROM `love_partner` WHERE `partner` = ".intval($partner)." LIMIT 1;");
$row = @mysql_fetch_array($partner_arr);
$partner_site = $row['site'];
$partner_name = $row['name'];
//----------
$title = 'Админ-Панель';
include ('../header.php');
echo $header;
if($mod == '1') echo '<p align="center"><small>';
if(isset($_GET['up'])) $up = $_GET['up']; else $up = "0";
switch ($up) {

case "0":
echo $class_d2;
echo 'Админ-Панель<br/>';
echo $class_divz.$class_d1;
if($mod == '1') echo '</small></p><p align="left"><small>';
echo '-&#187; <a href="'.$PHP_SELF.'?up=1&amp;partner='.$partner.'&amp;mod='.$mod.'&amp;'.$srand.'='.$r_rand.'&amp;'.session_name().'='.session_id().'">Обратная связь ('.$support.')</a><br/>';
echo $class_divz;
break;

case "1":
$sql = mysql_query("SELECT * FROM `love_support`;");
echo $class_d2;
echo 'Обратная связь<br/>';
echo $class_divz;
if($mod == '1') echo '</small></p><p align="left"><small>';
if(mysql_affected_rows() == 0) {
echo $class_d3;
echo 'Писем нет!<br/>';
echo $class_divz;
}
else
{
$url = ''.$PHP_SELF.'?up=1&amp;partner='.$partner.'&amp;mod='.$mod.'&amp;'.$srand.'='.$r_rand.'&amp;'.session_name().'='.session_id().'&amp;';
$wf = ONPAGE_USER;
$tp = mysql_num_rows($sql);
$mp = ceil($tp/$wf);
$page = (int)$_GET['page'];
if($page < 1) $page = 1;
if($page > $mp) $page = $mp;
$start = $page * $wf - $wf;
if(!preg_match('#^[0-9]{1,3}$#i',$page)) $page = 1;
//----------
$arr = mysql_query("SELECT * FROM `love_support` ORDER BY `id` DESC LIMIT ".intval($start).",".intval($wf).";");
while($supp = mysql_fetch_array($arr)) {
$name = $supp['name'];
$tema = $supp['tema'];
$email = $supp['email'];
$icq = $supp['icq'];
$msg = $supp['msg'];
$time = $supp['time'];
echo $class_d1;
echo '<b>Имя:</b> '.$name.' ('.$time.')<br/>';
if (!empty($email)) echo '<b>E-mail:</b> '.$email.'<br/>';
if (!empty($icq)) echo '<b>ICQ:</b> '.$icq.'<br/>';
echo '<b>Сообщение:</b> '.$msg.'<br/>';
if($mod == '1') echo '---<br/>';
echo $class_divz;
}
if ($tp > ONPAGE_USER) {echo $class_d0; page($tp, $page, $wf, $url); echo $class_divz; if($mod == '1') echo '<br/>---<br/>';}
}
break;

case "2":
echo $class_d2;
echo 'Админ-Панель<br/>';
echo $class_divz;
if($mod == '1') echo '</small></p><p align="left"><small>';
$id = intval($_GET['id']);
$sql = mysql_query("select * from `love_user` where `id` = '".$id."' LIMIT 1;");
if (mysql_affected_rows()==0)
{
echo $class_d0;
echo 'Такого юзера нет!<br/>';
}
else
{
@mysql_query("DELETE FROM `love_messages` WHERE `ids` = '".intval($id)."' LIMIT 1");
@mysql_query("DELETE FROM `love_messages` WHERE `uid` = '".intval($id)."' LIMIT 1");
@mysql_query("DELETE FROM `love_user` WHERE `id` = '".intval($id)."' LIMIT 1");
echo $class_d0;
echo 'Юзер успешно удален!<br/>';
}
echo $class_divz;
break;

case "3":
echo $class_d2;
echo 'Админ-Панель<br/>';
echo $class_divz;
if($mod == '1') echo '</small></p><p align="left"><small>';
$id = intval($_GET['id']);
$sql = mysql_query("select * from `love_user` where `id` = '".$id."' LIMIT 1;");
if (mysql_affected_rows()==0)
{
echo $class_d0;
echo 'Такого юзера нет!<br/>';
}
else
{
@mysql_query("UPDATE `love_user` SET `bann` = '1' where `id` = '".$id."' LIMIT 1;");
echo $class_d0;
echo 'Юзер успешно забанен!<br/>';
}
echo $class_divz;
break;

case "4":
echo $class_d2;
echo 'Админ-Панель<br/>';
echo $class_divz;
if($mod == '1') echo '</small></p><p align="left"><small>';
$id = intval($_GET['id']);
$sql = mysql_query("select * from `love_user` where `id` = '".$id."' LIMIT 1;");
if (mysql_affected_rows()==0)
{
echo $class_d0;
echo 'Такого юзера нет!<br/>';
}
else
{
@mysql_query("UPDATE `love_user` SET `bann` = '0' where `id` = '".$id."' LIMIT 1;");
echo $class_d0;
echo 'Юзер успешно разбанен!<br/>';
}
echo $class_divz;
break;
}
echo $class_d0;
echo '&#171;- <a href="admins.php?partner='.$partner.'&amp;mod='.$mod.'&amp;'.$srand.'='.$r_rand.'&amp;'.session_name().'='.session_id().'">Назад</a><br/>';
echo $class_divz.$class_d1;
if($mod == '1') echo '---<br/>';
if (!$autorize) {
echo '[7] <a href="http://'.$_SERVER['HTTP_HOST'].'/index.php?partner='.$partner.'&amp;mod='.$mod.'&amp;'.session_name().'='.session_id().'" accesskey="7">Поиск</a> [8] <a href="http://'.$_SERVER['HTTP_HOST'].'/auth.php?partner='.$partner.'&amp;mod='.$mod.'&amp;'.session_name().'='.session_id().'" accesskey="8">Вход</a> [9] <a href="http://'.$_SERVER['HTTP_HOST'].'/reg.php?partner='.$partner.'&amp;mod='.$mod.'&amp;'.session_name().'='.session_id().'" accesskey="9">Регистрация</a><br/>';
}
else
{
echo '[7] <a href="http://'.$_SERVER['HTTP_HOST'].'/index.php?partner='.$partner.'&amp;mod='.$mod.'&amp;'.session_name().'='.session_id().'" accesskey="7">Поиск</a> [8] <a href="http://'.$_SERVER['HTTP_HOST'].'/menu.php?partner='.$partner.'&amp;mod='.$mod.'&amp;'.session_name().'='.session_id().'" accesskey="8">Личное меню</a> [9] <a href="http://'.$_SERVER['HTTP_HOST'].'/out.php?partner='.$partner.'&amp;mod='.$mod.'&amp;'.session_name().'='.session_id().'" accesskey="9">Выход</a><br/>';
}
if($mod == '1') echo '</small></p><p align="center"><small>';
echo $class_divz.$class_d2;
echo $class_divz.$class_d2.$class_version.$class_divz.$class_div;
echo $class_endpage;
?>