Вход Регистрация
Файл: region_clean/journal/admin.php
Строк: 652
<?php
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################

require_once "../start.php";
require_once 
"../sid.php";

header('Cache-Control: no-store, no-cache, must-revalidate');
if (
$ver == "wml"header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else 
header("Content-Type:text/html; charset=UTF-8");

require_once 
"../inc.php";
$link connect_db();
list(
$row$id$ps$fsize1$fsize2) = check_login($link);
require_once 
"../version.php";

if (
$ver == "wml") {
echo 
$xml;
echo 
$dtd;
echo 
"<wml>
      <card id="
index" title="Журнал чата Админка">
      <p align="
center">";
} else {
echo 
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"";
echo ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">";
echo "<html xmlns="http://www.w3.org/1999/xhtml">
      
<head><link rel="stylesheet" type="text/css" href="../css/$css.css"/>
      <
title>Журнал чата Админка</title>
      <
meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
      <
div align="center">";
}


$config_bookpost = 5;

$day = date("d.m.y");
$timer = date("H:i");

$idsd = $_SESSION['id'];

echo '<div class="
c4">Управление журналом</div><br/>';

if (
$action == "") {

$filex = file("editors.dat");
$countx = count($filex);
$switchx = 0;
$wordx = $idsd;
for (
$ix = 0; $ix < $countx$ix++) {
if (trim(
$filex[$ix]) == $wordx) { $switchx = 1; } }
if (
$switchx == 1)
{

echo '<a href="
admin.php?'.$ses.'&amp;ref='.$ref.'">Обновить</a> | ';
echo '<a href="
admin.php?action=add&amp;'.$ses.'&amp;ref='.$ref.'">Новая категория</a><br/>';

$resultx = mysql_query("SELECT `id`,`name`,`about`,`type`,`down_type`,`realidFROM `journalWHERE `type`='r' order by realid;");
$count_users_on_pagex = mysql_num_rows($resultx);

for(
$i = 0; $i < $count_users_on_pagex$i++)
{
$row = mysql_fetch_array($resultx);
$uid = $row[0];
$name = $row[1];
$about = $row[2];
$type = $row[3];
$downtype = $row[4];
$realid = $row[5];

if (
$downtype == 1) { echo'<a href="admin.php?action=cat&amp;uid='.$uid.'&amp;'.$ses.'&amp;ref='.$ref.'">'.$name.'</a><br/><small>'.$about.'</small><br/>';
}
if (
$downtype == 0) { echo''.$name.'<br/><small>'.$about.'</small><br/>[Без подкатегорий]<br/>'; }

echo'<a href="
admin.php?action=edit&amp;uid='.$uid.'&amp;'.$ses.'&amp;ref='.$ref.'">[Изменить]</a> <a href="admin.php?action=del&amp;uid='.$uid.'&amp;'.$ses.'&amp;ref='.$ref.'">[Удалить]</a><br/><br/>';

}
echo '<br/>';
}
else { echo 'Ты не редактор журнала!<br/><br/>'; }
}
//---------------------------------------- РЕДАКТИРОВАНИЕ -------------------------------------------//
if (
$action == "edit") {

$filex = file("editors.dat");
$countx = count($filex);
$switchx = 0;
$wordx = $idsd;
for (
$ix = 0; $ix < $countx$ix++) {
if (trim(
$filex[$ix]) == $wordx) { $switchx=1; } }
if (
$switchx == 1)
{
$uid = intval($_GET['uid']);
if (!is_numeric(
$uid))
{
echo 'Попытка взлома! Я тебя запомнил <font color="
#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'">Прихожая</a><br/>';
include_once 
"../foot.php"
ob_end_flush(); 
exit;
}
if (empty(
$_GET['uid'])) {
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
$typ mysql_query("select * from `journal` where id='" $uid "';");
$ms mysql_fetch_array($typ);
if (
$ms['type'] != "r")
{
echo 
'Ошибка!<br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

echo 
"Изменить название:<br/><form action='admin.php?action=editgo&amp;uid=".$uid."&amp;".$ses."&amp;ref=".$ref."' method='post'><input type='text' name='nf' value='" $ms[name] . "'/><br/>Изменить описание:<br/><input type='text' name='ab' value='" $ms[about] . "'/><br/><input type='submit' class='ibutton' name='submit' value='Ok!'/><br/></form>";

} else { echo 
'Ты не Админ журнала!<br/><br/>'; }
}

if (
$action == "cat") {

$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$idsd";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx=1; } }
if (
$switchx == 1)
{

$uid intval($_GET['uid']);
if (!
is_numeric($uid))
{
echo 
'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo 
'<a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (empty(
$_GET['uid'])) {
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
$typ mysql_query("select * from `journal` where id='" $uid "';");
$ms mysql_fetch_array($typ);
if (
$ms['type'] != "r")
{
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (
$ms['down_type'] != 1)
{
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

echo 
'<a href="admin.php?action=cat&amp;uid='.$uid.'&amp;'.$ses.'&amp;ref='.$ref.'">Обновить</a> | ';
echo 
'<a href="admin.php?action=addf&amp;fid='.$uid.'&amp;'.$ses.'&amp;ref='.$ref.'">Новая категория</a><br/><br/>';

$resultx mysql_query("SELECT `id`,`name`,`about`,`type`,`down_type`,`realid`,`refid` FROM `journal` WHERE `type`='f' AND `refid`='".$uid."' order by realid;");
$count_users_on_pagex mysql_num_rows($resultx);

for(
$i 0$i $count_users_on_pagex$i++)
{
$row mysql_fetch_array($resultx);
$uid $row[0];
$name $row[1];
$about $row[2];
$type $row[3];
$downtype $row[4];
$realid $row[5];
$refid $row[6];

echo 
$name.'<br/><small>'.$about.'</small><br/>';

echo 
'<a href="admin.php?action=editf&amp;uid='.$uid.'&amp;'.$ses.'&amp;ref='.$ref.'">[Изменить]</a> <a href="admin.php?action=delf&amp;uid='.$uid.'&amp;'.$ses.'&amp;ref='.$ref.'">[Удалить]</a><br/><br/>';

}
echo 
'<br/>';
}
else { echo 
'Ты не редактор журнала!<br/><br/>'; }

}

//---------------------------------------- ИЗМЕНЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if ($action == "editgo") {

$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$idsd";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx=1; } }
if (
$switchx == 1)
{

$nf mysql_real_escape_string(check(trim($_POST['nf'])));
$ab mysql_real_escape_string(check(trim($_POST['ab'])));

$uid intval($_GET['uid']);
if (!
is_numeric($uid))
{
echo 
'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo 
'<a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (empty(
$_GET['uid'])) {
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
$typ mysql_query("select * from `journal` where id='" $uid "';");
$ms mysql_fetch_array($typ);
if (
$ms['type'] != "r")
{
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

mysql_query("update `journal` set  name='" $nf "', about='" $ab "' where id='" $uid "';");

echo 
'Категория изменена!<br/><br/>';
}
else { echo 
'Ты не Админ журнала!<br/><br/>'; }
}

//---------------------------------------- УДАЛЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if ($action == "del") {

$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$idsd";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx=1; } }
if (
$switchx == 1)
{
$uid intval($_GET['uid']);
if (!
is_numeric($uid))
{
echo 
'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo 
'<a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (empty(
$_GET['uid'])) {
echo 
'Ошибка!<br/>'
include_once
"../foot'.php"
ob_end_flush(); 
exit;
}
$typ mysql_query("select * from `journal` where id='" $uid "';");
$ms mysql_fetch_array($typ);
if (
$ms['type'] != "r")
{
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

if (
$ms['down_type'] == 0)
{

$raz mysql_query("select * from `journal` where refid='" $uid "' and type='a' ;");
                        while (
$raz1 mysql_fetch_assoc($raz))
                        {
                            
$tem mysql_query("select * from `journal` where refid='".intval($raz1['id'])."' and type='k';");
                            while (
$tem1 mysql_fetch_assoc($tem))
                            {
                            
mysql_query("delete from `journal` where `id`='".intval($tem1['id'])."';");
                            }
                            
mysql_query("delete from `journal` where `id`='".intval($raz1['id'])."';");
                        }
                        
mysql_query("delete from `journal` where `id`='".intval($uid)."';");

}
if (
$ms['down_type'] == 1)
{

$raz mysql_query("select * from `journal` where refid='" $uid "' and type='f' ;");
                        while (
$raz1 mysql_fetch_assoc($raz))
                        {
                            
$tem mysql_query("select * from `journal` where refid='".intval($raz1['id'])."' and type='a';");
                            while (
$tem1 mysql_fetch_assoc($tem))
                            {

                               
$temk mysql_query("select * from `journal` where refid='".intval($tem['id'])."' and type='k';");
                                while (
$tem1k mysql_fetch_assoc($temk))
                                {
                                
mysql_query("delete from `journal` where `id`='".intval($tem1k['id'])."';");}

                            
mysql_query("delete from `journal` where `id`='".intval($tem1['id'])."';");

                            }

                        
mysql_query("delete from `journal` where `id`='".intval($raz1['id'])."';");

                        }
mysql_query("delete from `journal` where `id`='" $uid "';");

}

} else { echo 
'Ты не Админ журнала!<br/><br/>'; }

}


if (
$action == "editf") {

$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$idsd";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx 1; } }
if (
$switchx == 1)
{
$uid intval($_GET['uid']);
if (!
is_numeric($uid))
{
echo 
'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo 
'<a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (empty(
$_GET['uid'])) {
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
$typ mysql_query("select * from `journal` where id='" $uid "';");
$ms mysql_fetch_array($typ);
if (
$ms['type'] != "f")
{
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

echo 
"Изменить название:<br/><form action='admin.php?action=editfgo&amp;uid=".$uid."&amp;".$ses."&amp;ref=".$ref."' method='post'><input type='text' name='nf' value='" $ms['name'] . "'/><br/>Изменить описание:<br/><input type='text' name='ab' value='" $ms[about] . "'/><br/><input type='submit' class='ibutton' name='submit' value='Ok!'/><br/></form>";

} else { echo 
'Ты не Админ журнала!<br/><br/>'; }
}
//---------------------------------------- ИЗМЕНЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if ($action == "editfgo") {

$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$idsd";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx=1; } }
if (
$switchx == 1)
{

$nf mysql_real_escape_string(check(trim($_POST['nf'])));
$ab mysql_real_escape_string(check(trim($_POST['ab'])));

$uid intval($_GET['uid']);
if (!
is_numeric($uid))
{
echo 
'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo 
'<a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (empty(
$_GET['uid']))
{
echo 
'Ошибка!';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
$typ mysql_query("select * from `journal` where id='" $uid "';");
$ms mysql_fetch_array($typ);
if (
$ms['type'] != "f")
{
echo 
'Ошибка!<br/>'
include_once 
'../foot.php';
ob_end_flush(); 
exit;
}

mysql_query("update `journal` set  name='" $nf "', about='" $ab "' where id='" $uid "';");

echo 
'Категория изменена!<br/><br/>';
}
else { echo 
'Ты не Админ журнала!<br/><br/>'; }
}

//---------------------------------------- УДАЛЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if ($action == "delf") {

$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$idsd";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx=1; } }
if (
$switchx == 1)
{
$uid intval($_GET['uid']);
if (!
is_numeric($uid))
{
echo 
'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo 
'<a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (empty(
$_GET['uid'])) {
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
$typ mysql_query("select * from `journal` where id='" $uid "';");
$ms mysql_fetch_array($typ);
if (
$ms['type'] != "f")
{
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

$raz mysql_query("select * from `journal` where refid='" $uid "' and type='a' ;");
                        while (
$raz1 mysql_fetch_assoc($raz))
                        {
                            
$tem mysql_query("select * from `journal` where refid='".intval($raz1['id'])."' and type='k';");
                            while (
$tem1 mysql_fetch_assoc($tem))
                            {
                            
mysql_query("delete from `journal` where `id`='".intval($tem1['id'])."';");
                            }
                            
mysql_query("delete from `journal` where `id`='".intval($raz1['id'])."';");
                        }
                        
mysql_query("delete from `journal` where `id`='" $uid "';");


echo 
'Готово!<br/><br/>';

} else { echo 
'Ты не Админ журнала!<br/><br/>'; }

}


if (
$action == "add") {

$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$idsd";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx=1; } }
if (
$switchx == 1)
{

if (
$ver != "wml") {
echo 
'<form action="admin.php?action=addn&amp;'.$ses.'&amp;ref='.$ref.'" method="post">
      <b>Название:</b> <br/><input type="text" name="name"/><br/>
      <b>Описание:</b><br/>
      <textarea cols="25" rows="3" name="msg"></textarea><br/>
      <b>Будем в данной папке делать подпапки? *</b><br/><b>Да</b> <input name="trans" type="checkbox" value="y" /><br/>
      <br/><input type="submit" class="ibutton" value="Старт!" /></form>'
;
} else {

echo 
'Название:<br/>
      <input name="name"/><br/>
      Описание:<br/>
      <input name="msg"/><br/>
      Будем в данной папке делать подпапки? *<select name="trans"><option value="0">Нет</option>
      <option value="y">Да</option></select><br/>
      <anchor>Создать!
      <go href="admin.php?action=addn&amp;'
.$ses.'&amp;ref='.$ref.'" method="post">
      <postfield name="msg" value="$(msg)"/>
      <postfield name="name" value="$(name)"/>
      <postfield name="trans" value="$(trans)"/>
      </go></anchor><br/>--------------------<br/>'
;
}
echo 
'* Выбрать тип категории (с подпапками или нет) можно выбрать один раз! И изменить данную опцию потом уже нельзя.<br/><br/>';
}
else { echo 
'Ты не Админ журнала<br/><br/>'; }
}

if (
$action == "addn") {

$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$idsd";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx 1; } }
if (
$switchx == 1)
{

$dates date("d.m.y");
$times date("H:i");
$time time();

$name $_POST['name'];
$msg $_POST['msg'];
$id $row['id'];
$name mysql_real_escape_string(check($name));
$msg mysql_real_escape_string(check($msg));

if (empty(
$msg)) { 
echo 
'Введи описание папки!!!
      <br/><br/><a href="admin.php?'
.$ses.'&amp;ref='.$ref.'">Назад</a><br/>
      <a href="../apanel.php?'
.$ses.'&amp;ref='.$ref.'">В админку</a><br/>
      <a href="../enter.php?'
.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (empty(
$name)) {
echo 
'Введи название папки!!!
      <br/><br/><a href="admin.php?'
.$ses.'&amp;ref='.$ref.'">Назад</a><br/>
      <a href="../apanel.php?'
.$ses.'&amp;ref='.$ref.'">В админку</a><br/>
      <a href="../enter.php?'
.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

if (
$trans == "y") { $type=1; }
if (
$trans != "y") { $type=0; }

$r mysql_query ("select id,user from users where id='$id';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];

$q mysql_query("select * from `journal` where type='r' order by realid desc ;");
$q1 mysql_num_rows($q);
if (
$q1 == 0)
{
$rid 1;
} else
{
while (
$arr mysql_fetch_assoc($q))
{
$arr1[] = $arr[realid];
}
$rid $arr1[0] + 1;
}

mysql_query("insert into `journal` values(0,'','".$name."','" $msg "','','r','','','','','','".$type."','','".$rid."','','','');");

echo 
'Папка создана!<br/><br/>';

if (
$type == 1) { echo 'Выбран тип папки - подпапочный. По-этому нужно создать подпапки в данном разделе.<br/><br/>'; }
if (
$type == 0) { echo 'Выбран тип папки - для статей. Теперь в данной категории можно сразу писать статьи.<br/><br/>'; }

}
else { echo 
'Ты не Админ выборов!<br/><br/>'; }
}

if (
$action == "addf") {

$fid intval($_GET['fid']);
if (!
is_numeric($fid))
{
echo 
'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo 
'<a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (empty(
$_GET['fid'])) {
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
$typ mysql_query("select * from `journal` where id='" $fid "';");
$ms mysql_fetch_array($typ);
if (
$ms['type'] != "r")
{
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$idsd";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx 1; } }
if (
$switchx == 1)
{

if (
$ver != "wml") {
echo 
'<form action="admin.php?action=addnf&amp;'.$ses.'&amp;ref='.$ref.'&amp;fid='.$fid.'" method="post">
      <b>Название:</b> <br/><input type="text" name="name"/><br/>
      <b>Описание:</b><br/>
      <textarea cols="25" rows="3" name="msg"></textarea><br/>
      <br/><input type="submit" class="ibutton" value="OK!" /></form>'
;
} else {
echo 
'Название:<br/>
      <input name="name"/><br/>
      Описание:<br/>
      <input name="msg"/><br/>
      <anchor>Создать!
      <go href="admin.php?action=addnf&amp;'
.$ses.'&amp;ref='.$ref.'&amp;fid='.$fid.'" method="post">
      <postfield name="msg" value="$(msg)"/>
      <postfield name="name" value="$(name)"/>
      <postfield name="trans" value="$(trans)"/>
      </go></anchor><br/>--------------------<br/>'
;
}
}
else { echo 
'Ты не редактор журнала<br/><br/>'; }
}

if (
$action == "addnf") {

$fid intval($_GET['fid']);
if (!
is_numeric($fid))
{
echo 
'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo 
'<a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (empty(
$_GET['fid'])) {
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
$typ mysql_query("select * from `journal` where id='" $fid "';");
$ms mysql_fetch_array($typ);
if (
$ms['type'] != "r")
{
echo 
'Ошибка!<br/>'
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$idsd";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx=1; } }
if (
$switchx == 1)
{
$dates date("d.m.y");
$times date("H:i");
$time time();

$name $_POST['name'];
$msg $_POST['msg'];
$fid $_GET['fid'];
$name mysql_real_escape_string(check($name));
$msg mysql_real_escape_string(check($msg));
$fid intval($fid);

if (empty(
$msg)) {
echo 
'Введи описание папки!!!
      <br/><br/><a href="admin.php?'
.$ses.'&amp;ref='.$ref.'">Назад</a><br/>
      <a href="../apanel.php?'
.$ses.'&amp;ref='.$ref.'">В админку</a><br/>
      <a href="../enter.php?'
.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}
if (empty(
$name)) {
echo 
'Введи описание папки!!!
      <br/><br/><a href="admin.php?'
.$ses.'&amp;ref='.$ref.'">Назад</a><br/>
      <a href="../apanel.php?'
.$ses.'&amp;ref='.$ref.'">В админку</a><br/>
      <a href="../enter.php?'
.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

$r mysql_query ("select id,user from users where id='$id';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];

$q mysql_query("select * from `journal` where type='f' and refid='".$fid."' order by realid desc ;");
$q1 mysql_num_rows($q);
if (
$q1 == 0)
{
$rid 1;
} else
{
while (
$arr mysql_fetch_assoc($q))
{
$arr1[] = $arr[realid];
}
$rid $arr1[0] + 1;
}

mysql_query("insert into `journal` values(0,'".$fid."','".$name."','" $msg "','','f','','','','','','','','".$rid."','','','');");

echo 
'Папка создана!<br/><br/>';

}
else { echo 
'Ты не редатор журнала!<br/><br/>'; }
}

if (
$action == "addadmin") {
$id $row['id'];
$r mysql_query ("select id,user,level from users where id='$id';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];
$lev $arr['level'];

if (
$lev 7) {

if (
$ver != "wml") {
echo 
'<form action="admin.php?action=addadminok&amp;'.$ses.'&amp;ref='.$ref.'" method="post">
      <b>ID Юзера:</b> <br/><input type="text" name="uid"/><br/>
      <br/><input type="submit" class="ibutton" value="Назначить!" /></form>'
;
} else {
echo 
'ID Юзера:<br/>
      <input name="uid"/><br/>
      <anchor>Создать!
      <go href="admin.php?action=addadminok&amp;'
.$ses.'&amp;ref='.$ref.'" method="post">
      <postfield name="uid" value="$(uid)"/>
      </go></anchor><br/>--------------------<br/>'
;
}
 }
}
if (
$action == "addadminok") {

$id $row['id'];
$r mysql_query ("select id,user,level from users where id='$id';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];
$lev $arr['level'];
$uid $_POST['uid'];
$uid check ($uid);

if (!
is_numeric($uid))
{
echo 
'ТОЛЬКО ИД ЮЗЕРА! ЦИФРЫ!!!';
echo 
'<a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

if (empty(
$uid)) {
echo 
'Введи ID юзера!!!
      <br/><br/><a href="admin.php?'
.$ses.'&amp;ref='.$ref.'">Назад</a><br/>
      <a href="../apanel.php?'
.$ses.'&amp;ref='.$ref.'">В админку</a><br/>
      <a href="../enter.php?'
.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

if (
$lev 7) {
$filex file("editors.dat");
$countx count($filex);
$switchx 0;
$wordx "$uid";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx=1; } }
if (
$switchx == 1)
{
echo 
'Данный юзер уже добавлен в список редакторов!<br/>';
}
else 
{

$tex "$uid";
$fp fopen("editors.dat","a+");
flock
($fp,LOCK_EX);
fputs($fp,"$texrn");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
@
chmod("$fp"0777);
@
chmod("editors.dat"0777);
echo 
'Теперь пользователь с ID '.$uid.' сможет полностью администрировать журнал!<br/>';
}
}
}

if (
$action == "addadmin2") {
$id $row['id'];
$r mysql_query ("select id,user,level from users where id='$id';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];
$lev $arr['level'];

if (
$lev 7) {

if (
$ver != "wml") {
echo 
'<form action="admin.php?action=addadminok2&amp;'.$ses.'&amp;ref='.$ref.'" method="post">
      <b>ID Юзера:</b> <br/><input type="text" name="uid"/><br/>
      <br/><input type="submit" class="ibutton" value="Назначить!" /></form>'
;
} else {
echo 
'ID Юзера:<br/>
      <input name="uid"/><br/>
      <anchor>Создать!
      <go href="admin.php?action=addadminok2&amp;'
.$ses.'&amp;ref='.$ref.'" method="post">
      <postfield name="uid" value="$(uid)"/>
      </go></anchor><br/>--------------------<br/>'
;
}
 }
}
if (
$action == "addadminok2") {

$id $row['id'];
$r mysql_query ("select id,user,level from users where id='$id';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];
$lev $arr['level'];
$uid $_POST['uid'];
$uid intval($uid);

if (!
is_numeric($uid))
{
echo 
'ТОЛЬКО ЦИФРЫ!!!';
echo 
'<a href="../enter.php?'.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

if (empty(
$uid)) {
echo 
'Введите ID юзера!!!
      <br/><br/><a href="admin.php?'
.$ses.'&amp;ref='.$ref.'">Назад</a><br/>
      <a href="../apanel.php?'
.$ses.'&amp;ref='.$ref.'">В админку</a><br/>
      <a href="../enter.php?'
.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php'
ob_end_flush(); 
exit;
}

if (
$lev 7) {

$filex file("journalist.dat");
$countx count($filex);
$switchx 0;
$wordx "$uid";
for (
$ix 0$ix $countx$ix++) {
if (
trim($filex[$ix]) == $wordx) { $switchx=1; } }
if (
$switchx == 1)
{
echo 
'Данный юзер уже добавлен в список журналистов!<br/>';
}
else {

$tex "$uid";
$fp fopen("journalist.dat","a+");
flock
($fp,LOCK_EX);
fputs($fp,"$texrn");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
@
chmod("$fp"0777);
@
chmod("journalist.dat"0777);
echo 
'Теперь пользователь с ID ' $uid ' может добавлять статьи в журнал!<br/>';
}
}
}

if (
$action == "readlist") {
$id $row['id'];
$r mysql_query ("select id,user,level from users where id='$id';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];
$lev $arr['level'];
if (
$lev 7) {
echo 
'<br/>Список редакторов:<br/>';

$file file("editors.dat");
$total count($file);
if (empty(
$_GET['start'])) $start 0;
else 
$start intval($_GET['start']);
if (
$total $start $config_bookpost) { $end $total; }
else {
$end $start $config_bookpost
}
for (
$fm $start$fm $end$fm++) {

$file file("editors.dat");
$file array_reverse($file);
$dt explode("|",$file[$fm]);

$num=$total-$fm-1;

if (
$fm >= 0) {

$r mysql_query ("select id,user from users where id='$dt[0]';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];
$lev $arr['level'];

echo 
'<br/>';
echo 
"<b><a href='../info.php?$ses&amp;nk=$usid&amp;ref=$ref'> $login </a></b>";
echo 
'<a href="admin.php?action=deluser&amp;rd='.$num.'&amp;start='.$start.'&amp;uz='.$dt[0].'&amp;nm='.$dt[0].'&amp;'.$ses.'&amp;ref='.$ref.'">[Удалить]</a><br/>';
}
}
if (
$total 1) { echo '<br/>Редакторов пока нет!<br/>'; }

echo 
$divide;
if (
$start != 0) { echo '<a href="admin.php?action=readlist&amp;start='.($start $config_bookpost).'&amp;'.$ses.'&amp;ref='.$ref.'">&lt;-Назад </a> ';
} else {
echo 
'&lt;-Назад ';
}
echo 
'|';
if (
$total $start $config_bookpost) {
echo 
' <a href="admin.php?action=readlist&amp;start='.($start $config_bookpost).'&amp;'.$ses.'&amp;ref='.$ref.'">Далее-&gt;</a>';
} else {
echo 
' Далее-&gt;';
}

$ba=ceil($total/$config_bookpost);
$ba2=$ba*$config_bookpost-$config_bookpost;

echo 
'<br/>Страницы:';
$asd=$start-($config_bookpost*3);
$asd2=$start+($config_bookpost*4);

if (
$asd $total and $asd 0) {
echo 
' <a href="admin.php?action=readlist&amp;start=0&amp;'.$ses.'&amp;ref='.$ref.'">1</a> ... ';
}

for(
$i $asd$i $asd2;)
{
if (
$i $total and $i >= 0) {
$ii=floor(1+$i/$config_bookpost);

if (
$start == $i) {
echo 
' <b>'.$ii.'</b>';
               }
                else {
echo 
' <a href="admin.php?action=readlist&amp;start='.$i.'&amp;'.$ses.'&amp;ref='.$ref.'">'.$ii.'</a>';
                     } }


$i=$i+$config_bookpost; }
if (
$asd2 $total) {
echo 
' ... <a href="admin.php?action=readlist&amp;start='.$ba2.'&amp;'.$ses.'&amp;ref='.$ref.'">'.$ba.'</a>';
}

echo 
'<br/><br/>Всего редакторов: '.$total.' <br/>';
echo 
'<br/><a href="admin.php?action=addadmin&amp;'.$ses.'&amp;ref='.$ref.'">Добавить редактора</a><br/>';
}
}
///////////////////////////// Удаление юзера из списка читателей \\\\\\\\\\\\\\\\\\\\

if ($action == "deluser") {
$id $row['id'];
$r mysql_query ("select id,user,level from users where id='$id';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];
$lev $arr['level'];
if (
$lev 7) {
if (isset(
$rd))  {
$file file("editors.dat");
$fp fopen("editors.dat","w");
flock ($fp,LOCK_EX);
for (
$i 0$i sizeof($file); $i++) { if ($i == $rd) { unset($file[$i]); } }
fputs($fpimplode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
}
echo 
'Теперь пользователь не может администрировать журнал!<br/>';
}
}

if (
$action == "readlist2") {
$id $row['id'];
$r mysql_query ("select id,user,level from users where id='$id';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];
$lev $arr['level'];
if (
$lev 7) {
echo 
'<br/>Список журналистов:<br/>';

$file file("journalist.dat");
$total count($file);
if (empty(
$_GET['start'])) $start 0;
else 
$start intval($_GET['start']);
if (
$total $start $config_bookpost) { $end $total; }
else { 
$end $start $config_bookpost; }
for (
$fm $start$fm $end$fm++) {

$file file("journalist.dat");
$file array_reverse($file);
$dt explode("|",$file[$fm]);

$num $total $fm 1;

if (
$fm >= 0) {

$r mysql_query ("select id,user from users where id='$dt[0]';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];
$lev $arr['level'];

echo 
'<br/>';
echo 
"<b><a href='../info.php?$ses&amp;nk=$usid&amp;ref=$ref'> $login </a></b>";
echo 
'<a href="admin.php?action=deluser2&amp;rd='.$num.'&amp;start='.$start.'&amp;uz='.$dt[0].'&amp;nm='.$dt[0].'&amp;'.$ses.'&amp;ref='.$ref.'">[Удалить]</a><br/>';
}
}
if (
$total 1) {
echo 
'<br/>Журналистов пока нет!<br/>';
}

echo 
$divide;
if (
$start != 0) {
echo 
'<a href="admin.php?action=readlist&amp;start='.($start $config_bookpost).'&amp;'.$ses.'&amp;ref='.$ref.'">&lt;-Назад </a> ';
} else {
echo 
'&lt;-Назад ';
}
echo 
'|';
if (
$total $start $config_bookpost) {
echo 
' <a href="admin.php?action=readlist&amp;start='.($start $config_bookpost).'&amp;'.$ses.'&amp;ref='.$ref.'">Далее-&gt;</a>';
} else {
echo 
' Далее-&gt;';
}

$ba=ceil($total/$config_bookpost);
$ba2=$ba*$config_bookpost-$config_bookpost;

echo 
'<br/>Страницы:';
$asd=$start-($config_bookpost*3);
$asd2=$start+($config_bookpost*4);

if (
$asd $total and $asd 0) {
echo 
' <a href="admin.php?action=readlist&amp;start=0&amp;'.$ses.'&amp;ref='.$ref.'">1</a> ... ';
}

for(
$i=$asd$i $asd2;)
{
if (
$i $total and $i >= 0) {
$ii=floor(1+$i/$config_bookpost);

if (
$start == $i) {
echo 
' <b>'.$ii.'</b>';
               }
                else {
echo 
' <a href="admin.php?action=readlist&amp;start='.$i.'&amp;'.$ses.'&amp;ref='.$ref.'">'.$ii.'</a>';
                     } }


$i=$i+$config_bookpost;
}
if (
$asd2 $total) {
echo 
' ... <a href="admin.php?action=readlist&amp;start='.$ba2.'&amp;'.$ses.'&amp;ref='.$ref.'">'.$ba.'</a>';
}

echo 
'<br/><br/>Всего журналистов: '.$total.' <br/>';
echo 
'<br/><a href="admin.php?action=addadmin2&amp;'.$ses.'&amp;ref='.$ref.'">Добавить журналиста</a><br/>';
}
}
///////////////////////////// Удаление юзера из списка читателей \\\\\\\\\\\\\\\\\\\\

if ($action == "deluser2") {
$id $row['id'];
$r mysql_query ("select id,user,level from users where id='$id';");
$arr mysql_fetch_array($r);
$login $arr['user'];
$usid $arr['id'];
$lev $arr['level'];
if (
$lev 7) {
if (isset(
$rd))  {
$file file("journalist.dat");
$fp fopen("journalist.dat","w");
flock ($fp,LOCK_EX);
for (
$i 0$i sizeof($file); $i++) { 
if (
$i == $rd) { unset($file[$i]); } }
fputs($fpimplode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
}
echo 
'Теперь пользователь не является журналистом!<br/>';
}
}

echo 
'<a href="admin.php?'.$ses.'&amp;ref='.$ref.'">Главная журнала</a><br/>';
$r mysql_query ("select id,user,level from users where id='$idsd';");
$arr mysql_fetch_array($r);
$lev $arr['level'];
if (
$lev 7) {
echo 
'<a href="admin.php?action=readlist&amp;'.$ses.'&amp;ref='.$ref.'">Список редакторов</a><br/>
      <a href="admin.php?action=readlist2&amp;'
.$ses.'&amp;ref='.$ref.'">Список журналистов</a><br/>
      <a href="../apanel.php?'
.$ses.'&amp;ref='.$ref.'">В админку</a><br/>'
      }
echo 
'<a href="../journal/index.php?'.$ses.'&amp;ref='.$ref.'">Обзор журнала / Упр.статьями</a><br/>
      <a href="../enter.php?'
.$ses.'&amp;ref='.$ref.'">В прихожую</a><br/>';
include_once 
'../foot.php';
ob_end_flush();
exit;
?>
Онлайн: 0
Реклама