Файл: config.php
Строк: 107
<?php
error_reporting(0);
session_start();// Старт сессии
$vsego='10'; // Количество сообщений на страницу
if (!empty($_GET['mid']))
{
$_SESSION['mid']=$_GET['mid'];
if ($_GET['mid']=='1') {
$room='Общая'; }
if ($_GET['mid']=='2') {
$room='Модерская'; }
if ($_GET['mid']=='3') {
$room='Админская'; }
$_SESSION['text']='Ты находишся в комнате '.$room.'<br/>'; }
if (empty($_SESSION['mid']))
{ $mid=1; } else { $mid=$_SESSION['mid']; }
$_SESSION['mid']=$mid;
if (!empty($_SESSION['inside_id']) and !empty($_SESSION['inside_nick']) and !empty($_SESSION['inside_pass']) and !empty($_SESSION['inside_status'])
)
{
$id=$_SESSION['inside_id'];
$nick=$_SESSION['inside_nick'];
$pass=$_SESSION['inside_pass'];
if ($_SESSION['inside_status']=='Admin' and $mid=='3') {
$status=$_SESSION['inside_status']; }
elseif ($_SESSION['inside_status']=='Admin' and $mid=='2' or $_SESSION['inside_status']=='Moder' and $mid=='2') {
$status=$_SESSION['inside_status']; }
elseif ($_SESSION['inside_status']=='Admin' and $mid=='1' or $_SESSION['inside_status']=='Moder' and $mid=='1' or $_SESSION['inside_status']=='User' and $mid=='1') {
$status=$_SESSION['inside_status']; }
else { $status=''; }
}
else
{
$id='';
$pass='';
$nick='Гость';
$status='';
} // Авторизация
if ($status=='Banned') { exit('Забанен!'); } // Простой и нежелательный метод бана
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/newpart.php' and $status!=='Admin') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/editpart.php' and $status!=='Admin') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/delpart.php' and $status!=='Admin') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/postnewpart.php' and $status!=='Admin') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/posteditpart.php' and $status!=='Admin') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/postdelpart.php' and $status!=='Admin') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/edittopic.php' and $status!=='Admin' and $status!=='Moder') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/postedittopic.php' and $status!=='Admin' and $status!=='Moder') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/postdeltopic.php' and $status!=='Admin' and $status!=='Moder') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/editmsg.php' and $status!=='Admin' and $status!=='Moder') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/posteditmsg.php' and $status!=='Admin' and $status!=='Moder') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/postdelmes.php' and $status!=='Admin' and $status!=='Moder') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/posteditmes.php' and $status!=='Admin' and $status!=='Moder') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/poststatus.php' and $status!=='Admin') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/postdeluser.php' and $status!=='Admin') { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/posteditor.php' and empty($status)) { exit('Хакер, да?!<br/>'); }
if ($_SERVER['PHP_SELF']==dirname($_SERVER['PHP_SELF']).'/editor.php' and empty($status)) { exit('Хакер, да?!<br/>'); }
// Распределение управляющих страниц по статусу
if (!empty($status) and file_exists('users.dat')) {
$file=file('users.dat');
$count=count($file);
for($i=0;$i<$count;$i++)
{
$ex=explode('#/#/#',$file[$i]);
if ($ex[0]==$id) {
$time=time();
$string=str_replace($ex[0].'#/#/#'.$ex[1].'#/#/#'.$ex[2].'#/#/#'.$ex[3].'#/#/#'.$ex[4].'#/#/#'.$ex[5],$ex[0].'#/#/#'.$ex[1].'#/#/#'.$ex[2].'#/#/#'.$ex[3].'#/#/#'.$ex[4].'#/#/#'.$time,file_get_contents('users.dat'));
$fopen=fopen("users.dat","w");
fputs($fopen,$string);
fclose($fopen);
}
}
} // Запись он-лайн для авторизированых
?>