Файл: my/ignors.php
Строк: 135
<?php
define('GCMS',true);
define('ROOT','../');
require_once (ROOT.'system/power.php');
switch ($do) {
////отправление в игнор из анкеты
case 'zajav':
$u = $db -> query("SELECT `id` FROM `users` WHERE `id`='$id' and `id`<>'$ya[id]' LIMIT 1");
if ($u -> num_rows > 0) {
$ass = $u -> fetch_assoc();
$sql = $db -> query("SELECT * FROM `nuts` WHERE `idwh`='$id' and `user`='$ya[id]' and `where`='ignor' LIMIT 1");
if ($sql -> num_rows == 0) {
$sql2 = $db -> query("SELECT * FROM `nuts` WHERE `idwh`='$id' and `user`='$ya[id]' and `where`='frends' LIMIT 1");
if ($sql2 -> num_rows == 0) {
$sql2 = $db -> query("SELECT * FROM `nuts` WHERE `user`='$id' and `idwh`='$ya[id]' and `where`='frends' LIMIT 1");
if ($sql2 -> num_rows == 0) {
$db -> query("INSERT INTO `nuts` set `user` = '$ya[id]',`idwh` = '$id',`where` = 'ignor',`time` = '".time()."'");
header('location: ./id'.$id.'');
} else header('location: ./id'.$id.'');
} else header('location: ./id'.$id.'');
} else header('location: ./id'.$id.'');
} else header('location: ./id'.$id.'');
break;
////Удаление из игнора
case 'delfr':
$sql = $db -> query("SELECT * FROM `nuts` WHERE `id` = '".$id."' and `where`='ignor' and `user`='$ya[id]' LIMIT 1");
if ($sql -> num_rows > 0) {
$us = $sql -> fetch_assoc();
$db -> query("DELETE FROM `nuts` WHERE `id`='$id'");
header('location: ?');
} else header('location: ?');
break;
////Заявки в друзья
case 'jav':
$diz -> head('Вас игнорируют');
$count = $db -> dbcount('COUNT(`id`)','nuts',"`where`='ignor' and `idwh`='$ya[id]'");
$diz -> title('Вас игнорируют: <b>'.$count.'</b> чел.');
if($count>0){
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
$sql = $db -> query("SELECT * FROM `nuts` where `idwh`='$ya[id]' and `where`='ignor' ORDER BY `user` LIMIT ".$start.",".$num);
while ($users = $sql -> fetch_assoc()) {
$msg .= 'Игнор: '. $func -> user($users['user']).'<br/>';
}
$act = 'ignors.php?do=jav';
$msg .= $func -> pagenav($act,$page,$total);
}else{$msg.='Вас ни кто не игнорирует!';}
$msg .= '<div class="levo">'.$diz -> img('back.png').'<a href="?">Назад</a></br>
'.$diz -> img('back.png').'<a href="./">Личный кабинет</a></br>';
$msg .= ''.$diz -> img('home.png').'<a href="/index.php">На главную</a></div>';
#####Копирайт#######
require_once (ROOT.'system/kopy.php');
$diz -> out($msg);
break;
default:
$diz -> head('Чёрный список');
$count = $db -> dbcount('COUNT(`id`)','nuts',"`where`='ignor' and `user`='$ya[id]'");
$diz -> title('Чёрный список (Всего: <b>'.$count.'</b>)');
$jav = $db -> dbcount('COUNT(`id`)','nuts',"`where`='ignor' and `idwh`='$ya[id]'");
$msg.='<a href="?do=jav">Вас игнорируют</a>: '.$jav.' чел.<hr>';
if($count>0){
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
$sql = $db -> query("SELECT * FROM `nuts` where `user`='$ya[id]' and `where`='ignor' ORDER BY `id` LIMIT ".$start.",".$num);
while ($users = $sql -> fetch_assoc()) {
$msg .= ''. $func -> user($users['idwh']).' | <a href="?do=delfr&id='.$users['id'].'">Удалить</a><br/>';
}
$act = 'ignors.php?';
$msg .= $func -> pagenav($act,$page,$total);
}else{$msg.='Ваш чёрный список пуст!';}
if (empty($_POST['login'])) {
$msg .= '<hr><form action="?" method="post"><div>
Ник/ID:<br/><input type="text" name="login" maxlength="40" title="Введите Ник/ID"/><br/>
<input type="submit" value="Добавить в игнор" title="Добавить в игнор"/></div></form>';
}else{
$lg = shit($_POST['login']);
$u = $db -> query("SELECT `id` FROM `users` WHERE `id`='$lg' and `id`<>'$ya[id]' or `login`='$lg' and `login`<>'$ya[login]' LIMIT 1");
if ($u -> num_rows > 0) {
$ass = $u -> fetch_assoc();
$sql = $db -> query("SELECT * FROM `nuts` WHERE `idwh`='$ass[id]' and `user`='$ya[id]' and `where`='ignor' LIMIT 1");
if ($sql -> num_rows == 0) {
$sql2 = $db -> query("SELECT * FROM `nuts` WHERE `idwh`='$ass[id]' and `user`='$ya[id]' and `where`='frends' LIMIT 1");
if ($sql2 -> num_rows == 0) {
$sql2 = $db -> query("SELECT * FROM `nuts` WHERE `user`='$ass[id]' and `idwh`='$ya[id]' and `where`='frends' LIMIT 1");
if ($sql2 -> num_rows == 0) {
$db -> query("INSERT INTO `nuts` set `user` = '$ya[id]',`idwh` = '$ass[id]',`where` = 'ignor',`time` = '".time()."'");
header('location: ?');
} else header('location: ?');
} else header('location: ?');
} else header('location: ?');
} else header('location: ?');
}
$msg .= '<div class="levo">'.$diz -> img('back.png').'<a href="./">Личный кабинет</a></br>';
$msg .= ''.$diz -> img('home.png').'<a href="/index.php">На главную</a></div>';
#####Копирайт#######
require_once (ROOT.'system/kopy.php');
$diz -> out($msg);
}
?>