<?php
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
//require_once"../template/maincore.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";

$text = file("../local/profil/$log.prof");
if ($text!=""){
$udata = explode(":||:",$text[0]);
$provlog=trim($udata[0]);
$provpar=trim($udata[1]);
$log_status=(int)$udata[36];
$dostup=trim($udata[7]);
$privat=trim($udata[10]);}

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

if (!$_SESSION['log']=="" && !md5($_SESSION['par'])=="" && md5($_SESSION['par'])==$provpar && $_SESSION['log']==$provlog ) {
 if ($dostup==101 || $dostup==102){
 		echo'<img src="../images/img/dot.gif" alt=""> <b>Управление 4aToM</b><br>';
 		//---------------------------------//
 	if (isset($_GET['mess'])){
 			if ($_GET['mess']=='add'){
 				echo '<font color="red">Комната успешно добавлена</font><br />';}
 				if ($_GET['mess']=='del'){
 					echo '<font color="red">Комната успешно удалена</font><br />';}
 					if ($_GET['mess']=='clear'){
 						echo '<font color="red">Комната успешно очищена</font><br />';}
 						if ($_GET['mess']=='ren'){
 							echo '<font color="red">Комната успешно переименована</font><br />';}
 							if ($_GET['mess']=='up' || $_GET['mess']=='down'){
 								echo '<font color="red">Комната успешно сдвинута</font><br />';}
 		if ($_GET['mess']=='umn_add'){
 			echo '<font color="red">Умник добавлен</font><br />\r\n';}
 			if ($_GET['mess']=='umn_del'){
 				echo '<font color="red">Умник удален</font><br />\r\n';}
 				if ($_GET['mess']=='shut_add'){
 					echo '<font color="red">Шутник добавлен</font><br />\r\n';}
 					if ($_GET['mess']=='shut_del'){
 						echo '<font color="red">Шутник удален</font><br />\r\n';}
 						if ($_GET['mess']=='gal_add'){
 							echo '<font color="red">Comedy включен</font><br />\r\n';}
 							if ($_GET['mess']=='gal_del'){
 								echo '<font color="red">Comedy выключен</font><br />\r\n';}
 								if ($_GET['mess']=='matbot_add'){
 									echo '<font color="red">Пиздобол добавлен</font><br />\r\n';}
 		if ($_GET['mess']=='matbot_del'){
 			echo '<font color="red">Пиздобол удален</font><br />\r\n';}
 			if ($_GET['mess']=='matvopr_add'){
 				echo '<font color="red">Подъебки добавлены</font><br />\r\n';}
 				if ($_GET['mess']=='matvopr_del'){
 					echo '<font color="red">Подъебки удалены</font><br />\r\n';}
 					}
 	echo '<div class="b"><img src="../images/dot.gif" alt="" /> Чат</div>';
 	if (isset($_GET['act'])){
 		//--Добавление-комнат--//
 		if ($_GET['act']=='addroom'){
 			$newroom=stripslashes(htmlspecialchars($_POST['newroom']));
 			if ($newroom!=''){
 				$id_new=rand("1000000000", "99999999999");
 				$fm=fopen("../local/datachat/rooms.dat","a");
 				flock($fm,LOCK_EX);
 				fputs($fm,"$id_new:||:$newroom:||::||::||::||::||::||::||::||::||::||::||::||:\r\n");
 				fflush($fm);
 				flock($fm,LOCK_UN);
 				fclose($fm);
 				chmod ("../local/datachat/rooms.dat", 0666);
 				header ("Location: achat.php?mess=add&".SID."");
 				exit;}
 				}
 		//--Удаление-комнат--//
 		if ($_GET['act']=='delroom'){
 			$id_delroom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 			if (file_exists("../local/datachat/rooms.dat")){
 				$rooms=file("../local/datachat/rooms.dat");
 				$rooms_k=count($rooms);
 				for ($i=0;$i<$rooms_k;$i++){
 					$room5=explode(":||:",$rooms[$i]);
 					if ($room5[0]!=$id_delroom){
 						$new_rooms.=$rooms[$i];}
 						}
 						$fm=fopen("../local/datachat/rooms.dat","w");
 						flock($fm,LOCK_EX);
 						fputs($fm,"$new_rooms");
 						fflush($fm);
 						flock($fm,LOCK_UN);
 						fclose($fm);
 						chmod ("../local/datachat/rooms.dat", 0666);
 						@unlink("../local/datachat/$id_delroom.chat");
 						header ("Location: achat.php?mess=del&".SID."");
 						exit;}
 						}

 		if ($_GET['act']=='umn_add'){
 			$id_umroom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 			if (file_exists("../local/datachat/rooms.dat")){
 				$rooms=file("../local/datachat/rooms.dat");
 				$rooms_k=count($rooms);
 				for ($i=0;$i<$rooms_k;$i++){
 					$room5=explode(":||:",$rooms[$i]);
 					if ($room5[0]==$id_umroom){
 						$rooms[$i]="$room5[0]:||:$room5[1]:||:1:||:$room5[3]:||:$room5[4]:||:$room5[5]:||:$room5[6]:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 						}
 					}
 					for ($i=0;$i<$rooms_k;$i++){
 						$new_file_rooms.=$rooms[$i];}
 						$fm=fopen("../local/datachat/rooms.dat","w");
 						flock($fm,LOCK_EX);
 						fputs($fm,"$new_file_rooms");
 						fflush($fm);
 						flock($fm,LOCK_UN);
 						fclose($fm);
 						chmod ("../local/datachat/rooms.dat", 0666);
 						header ("Location: achat.php?mess=umn_add&".SID."");
 						exit;}
 						}

 		if ($_GET['act']=='umn_del'){
 			$id_umroom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 			if (file_exists("../local/datachat/rooms.dat")){
 				$rooms=file("../local/datachat/rooms.dat");
 				$rooms_k=count($rooms);
 				for ($i=0;$i<$rooms_k;$i++){
 					$room5=explode(":||:",$rooms[$i]);
 					if ($room5[0]==$id_umroom){
 						$rooms[$i]="$room5[0]:||:$room5[1]:||:0:||:$room5[3]:||:$room5[4]:||:$room5[5]:||:$room5[6]:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 						}
 					}
 					for ($i=0;$i<$rooms_k;$i++){
 						$new_file_rooms.=$rooms[$i];}
 						$fm=fopen("../local/datachat/rooms.dat","w");
 						flock($fm,LOCK_EX);
 						fputs($fm,"$new_file_rooms");
 						fflush($fm);
 						flock($fm,LOCK_UN);
 						fclose($fm);
 						chmod ("../local/datachat/rooms.dat", 0666);
 						header ("Location: achat.php?mess=umn_del&".SID."");
 						exit;}
 						}

 		if ($_GET['act']=='ves_del'){
 			$id_umroom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 			if (file_exists("../local/datachat/rooms.dat")){
 				$rooms=file("../local/datachat/rooms.dat");
 				$rooms_k=count($rooms);
 				for ($i=0;$i<$rooms_k;$i++){
 					$room5=explode(":||:",$rooms[$i]);
 					if ($room5[0]==$id_umroom){
 						$rooms[$i]="$room5[0]:||:$room5[1]:||:$room5[2]:||:0:||:$room5[4]:||:$room5[5]:||:$room5[6]:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 						}
 					}
 					for ($i=0;$i<$rooms_k;$i++){
 						$new_file_rooms.=$rooms[$i];
 						}
 						$fm=fopen("../local/datachat/rooms.dat","w");
 						flock($fm,LOCK_EX);
 						fputs($fm,"$new_file_rooms");
 						fflush($fm);
 						flock($fm,LOCK_UN);
 						fclose($fm);
 						chmod ("../local/datachat/rooms.dat", 0666);
 						header ("Location: achat.php?mess=shut_del&".SID."");
 						exit;}
 						}

 		if ($_GET['act']=='ves_add'){
 			$id_umroom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 			if (file_exists("../local/datachat/rooms.dat")){
 				$rooms=file("../local/datachat/rooms.dat");
 				$rooms_k=count($rooms);
 				for ($i=0;$i<$rooms_k;$i++){
 					$room5=explode(":||:",$rooms[$i]);
 					if ($room5[0]==$id_umroom){
 						$rooms[$i]="$room5[0]:||:$room5[1]:||:$room5[2]:||:1:||:$room5[4]:||:$room5[5]:||:$room5[6]:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 						}
 						}
 						for ($i=0;$i<$rooms_k;$i++){
 							$new_file_rooms.=$rooms[$i];}
 							$fm=fopen("../local/datachat/rooms.dat","w");
 							flock($fm,LOCK_EX);
 							fputs($fm,"$new_file_rooms");
 							fflush($fm);
 							flock($fm,LOCK_UN);
 							fclose($fm);
 							chmod ("../local/datachat/rooms.dat", 0666);
 							header ("Location: achat.php?mess=shut_add&".SID."");
 							exit;}
 							}

 		if ($_GET['act']=='gal_add'){
 			$id_groom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 			if (file_exists("../local/datachat/rooms.dat")){
 				$rooms=file("../local/datachat/rooms.dat");
 				$rooms_k=count($rooms);
 				for ($i=0;$i<$rooms_k;$i++){
 					$room5=explode(":||:",$rooms[$i]);
 					if ($room5[0]==$id_groom){
 						$rooms[$i]="$room5[0]:||:$room5[1]:||:$room5[2]:||:$room5[3]:||:1:||:$room5[5]:||:$room5[6]:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 						}
 					}
 					for ($i=0;$i<$rooms_k;$i++){
 						$new_file_rooms.=$rooms[$i];}
 						$fm=fopen("../local/datachat/rooms.dat","w");
 						flock($fm,LOCK_EX);
 						fputs($fm,"$new_file_rooms");
 						fflush($fm);
 						flock($fm,LOCK_UN);
 						fclose($fm);
 						chmod ("../local/datachat/rooms.dat", 0666);
 						header ("Location: achat.php?mess=gal_add&".SID."");
 						exit;}
 						}

 		if ($_GET['act']=='gal_del'){
 			$id_groom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 			if (file_exists("../local/datachat/rooms.dat")){
 				$rooms=file("../local/datachat/rooms.dat");
 				$rooms_k=count($rooms);
 				for ($i=0;$i<$rooms_k;$i++){
 					$room5=explode(":||:",$rooms[$i]);
 					if ($room5[0]==$id_groom){
 						$rooms[$i]="$room5[0]:||:$room5[1]:||:$room5[2]:||:$room5[3]:||:0:||:$room5[5]:||:$room5[6]:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 						}
 					}
 					for ($i=0;$i<$rooms_k;$i++){
 						$new_file_rooms.=$rooms[$i];
 						}
 						$fm=fopen("../local/datachat/rooms.dat","w");
 						flock($fm,LOCK_EX);
 						fputs($fm,"$new_file_rooms");
 						fflush($fm);
 						flock($fm,LOCK_UN);
 						fclose($fm);
 						chmod ("../local/datachat/rooms.dat", 0666);
 						header ("Location: achat.php?mess=gal_del&".SID."");
 						exit;}
 						}
 		######################################
 		### ВСТАВЛЯЕМ ПИЗДОБОЛА И ПОДЪЕБКИ ###
 		######################################
 		if ($_GET['act']=='matbot_add'){
 			$id_groom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 			if (file_exists("../local/datachat/rooms.dat")){
 				$rooms=file("../local/datachat/rooms.dat");
 				$rooms_k=count($rooms);
 				for ($i=0;$i<$rooms_k;$i++){
 					$room5=explode(":||:",$rooms[$i]);
 					if ($room5[0]==$id_groom){
 						$rooms[$i]="$room5[0]:||:$room5[1]:||:$room5[2]:||:$room5[3]:||:$room5[4]:||:1:||:$room5[6]:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 						}
 					}
 					for ($i=0;$i<$rooms_k;$i++){
 						$new_file_rooms.=$rooms[$i];
 						}
 						$fm=fopen("../local/datachat/rooms.dat","w");
 						flock($fm,LOCK_EX);
 						fputs($fm,"$new_file_rooms");
 						fflush($fm);
 						flock($fm,LOCK_UN);
 						fclose($fm);
 						chmod ("../local/datachat/rooms.dat", 0666);
 						header ("Location: achat.php?mess=matbot_add&".SID."");
 						exit;}
 					}
 					if ($_GET['act']=='matbot_del'){
 						$id_groom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 						if (file_exists("../local/datachat/rooms.dat")){
 							$rooms=file("../local/datachat/rooms.dat");
 							$rooms_k=count($rooms);
 							for ($i=0;$i<$rooms_k;$i++){
 								$room5=explode(":||:",$rooms[$i]);
 								if ($room5[0]==$id_groom){
 									$rooms[$i]="$room5[0]:||:$room5[1]:||:$room5[2]:||:$room5[3]:||:$room5[4]:||:0:||:$room5[6]:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 									}
 								}
 								for ($i=0;$i<$rooms_k;$i++){
 									$new_file_rooms.=$rooms[$i];}
 									$fm=fopen("../local/datachat/rooms.dat","w");
 									flock($fm,LOCK_EX);
 									fputs($fm,"$new_file_rooms");
 									fflush($fm);
 									flock($fm,LOCK_UN);
 									fclose($fm);
 									chmod ("../local/datachat/rooms.dat", 0666);
 									header ("Location: achat.php?mess=matbot_del&".SID."");
 									exit;}
 									}
 					//---------------//
 					if ($_GET['act']=='matvopr_add'){
 						$id_groom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 						if (file_exists("../local/datachat/rooms.dat")){
 							$rooms=file("../local/datachat/rooms.dat");
 							$rooms_k=count($rooms);
 							for ($i=0;$i<$rooms_k;$i++){
 								$room5=explode(":||:",$rooms[$i]);
 								if ($room5[0]==$id_groom){
 									$rooms[$i]="$room5[0]:||:$room5[1]:||:$room5[2]:||:$room5[3]:||:$room5[4]:||:$room5[5]:||:1:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 									}
 								}
 								for ($i=0;$i<$rooms_k;$i++){
 									$new_file_rooms.=$rooms[$i];}
 									$fm=fopen("../local/datachat/rooms.dat","w");
 									flock($fm,LOCK_EX);
 									fputs($fm,"$new_file_rooms");
 									fflush($fm);
 									flock($fm,LOCK_UN);
 									fclose($fm);
 									chmod ("../local/datachat/rooms.dat", 0666);
 									header ("Location: achat.php?mess=matvopr_add&".SID."");
 									exit;}
 									}

 					if ($_GET['act']=='matvopr_del'){
 						$id_groom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 						if (file_exists("../local/datachat/rooms.dat")){
 							$rooms=file("../local/datachat/rooms.dat");
 							$rooms_k=count($rooms);
 							for ($i=0;$i<$rooms_k;$i++){
 								$room5=explode(":||:",$rooms[$i]);
 								if ($room5[0]==$id_groom){
 									$rooms[$i]="$room5[0]:||:$room5[1]:||:$room5[2]:||:$room5[3]:||:$room5[4]:||:$room5[5]:||:0:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 									}
 								}
 								for ($i=0;$i<$rooms_k;$i++){
 									$new_file_rooms.=$rooms[$i];}
 									$fm=fopen("../local/datachat/rooms.dat","w");
 									flock($fm,LOCK_EX);
 									fputs($fm,"$new_file_rooms");
 									fflush($fm);
 									flock($fm,LOCK_UN);
 									fclose($fm);
 									chmod ("../local/datachat/rooms.dat", 0666);
 									header ("Location: achat.php?mess=matvopr_del&".SID."");
 									exit;}
 									}
 									############################
 									### ВСТАВЛЯЕМ ПИЗДОБОЛА И ПОДЪЕБКИ the end
 									############################
 	 if ($_GET['act']=='rename'){
 		$id_renroom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 		$new_name=stripslashes(htmlspecialchars($_POST['new_name']));
 		if (file_exists("../local/datachat/rooms.dat")){
 			$rooms=file("../local/datachat/rooms.dat");
 			$rooms_k=count($rooms);
 			$rename_ok='0';
 			for ($i=0;$i<$rooms_k;$i++){
 				$room5=explode(":||:",$rooms[$i]);
 				if ($room5[0]==$id_renroom){
 					$rename_ok='1';
 					$room_name=$room5[1];}
 				}
 				if ($new_name==''){
 					$new_name=$room_name;}
 				if (isset($_GET['rename'])){
 					for ($i=0;$i<$rooms_k;$i++){
 						$room5=explode(":||:",$rooms[$i]);
 						if ($room5[0]==$id_renroom){
 							$rooms[$i]="$id_renroom:||:$new_name:||:$room5[2]:||:$room5[3]:||:$room5[4]:||:$room5[5]:||:$room5[6]:||:$room5[7]:||:$room5[8]:||:$room5[9]:||:$room5[10]:||:$room5[11]:||:$room5[12]:||:\r\n";
 							}
 						}
 						for ($i=0;$i<$rooms_k;$i++){
 							$new_file_rooms.=$rooms[$i];
 							}
 							$fm=fopen("../local/datachat/rooms.dat","w");
 							flock($fm,LOCK_EX);
 							fputs($fm,"$new_file_rooms");
 							fflush($fm);
 							flock($fm,LOCK_UN);
 							fclose($fm);
 							chmod ("../local/datachat/rooms.dat", 0666);
 							header ("Location: achat.php?mess=ren&".SID."");
 							exit;
 				}
 	echo "<form action=\"achat.php?act=rename&amp;rename&amp;id_room=$id_renroom&amp;".SID."\" method=\"post\">\r\n";
 	echo "Название комнаты:<br />";
 	echo "<input type=\"text\" name=\"new_name\" value=\"$room_name\" /><br /><br />\r\n";
 	echo "<input type=\"submit\" value=\"Изменить\" />\r\n";
 	echo "</form>";
 	echo '&laquo; <a href="achat.php?'.SID.'">Отмена</a>';
 	echo '<br><img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
 	include_once"../themes/$config_themes/foot.php";
 	exit;
 	  }
 	 }

 	 if ($_GET['act']=='clear'){
 		$id_clearroom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 		if (file_exists("../local/datachat/rooms.dat")){
 			@unlink("../local/datachat/$id_clearroom.chat");
 			header ("Location: achat.php?mess=clear&".SID."");
 			exit;}
 			}

 	 if ($_GET['act']=='up'){
 		$id_uproom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 		if (file_exists("../local/datachat/rooms.dat")){
 			$rooms=file("../local/datachat/rooms.dat");
 			$rooms_k=count($rooms);
 			$sdvig_ok='0';
 			for ($i=0;$i<$rooms_k;$i++){
 				$room5=explode(":||:",$rooms[$i]);
 				if ($room5[0]==$id_uproom){
 					$sdvig_ok='1';
 					$mesto1=$i;
 					$mesto2=$i-1;
 					}
 				}
 				if ($sdvig_ok=='1' && $mesto1>0){
 					$tmp_room=$rooms[$mesto2];
 					$rooms[$mesto2]=$rooms[$mesto1];
 					$rooms[$mesto1]=$tmp_room;}
 					for ($i=0;$i<$rooms_k;$i++){
 						$new_rooms.=$rooms[$i];}
 						$fm=fopen("../local/datachat/rooms.dat","w");
 						flock($fm,LOCK_EX);
 						fputs($fm,"$new_rooms");
 						fflush($fm);
 						flock($fm,LOCK_UN);
 						fclose($fm);
 						chmod ("../local/datachat/rooms.dat", 0666);
 						header ("Location: achat.php?mess=up&".SID."");
 						exit;}
 						}

 	 if ($_GET['act']=='down'){
 		$id_downroom=intval(stripslashes(htmlspecialchars($_GET['id_room'])));
 		if (file_exists("../local/datachat/rooms.dat")){
 			$rooms=file("../local/datachat/rooms.dat");
 			$rooms_k=count($rooms);
 			$sdvig_ok='0';
 			for ($i=0;$i<$rooms_k;$i++){
 				$room5=explode(":||:",$rooms[$i]);
 				if ($room5[0]==$id_downroom){
 					$sdvig_ok='1';
 					$mesto1=$i;
 					$mesto2=$i+1;}
 				}
 				if ($sdvig_ok=='1' && $mesto1<$rooms_k-1){
 					$tmp_room=$rooms[$mesto2];
 					$rooms[$mesto2]=$rooms[$mesto1];
 					$rooms[$mesto1]=$tmp_room;}
 					for ($i=0;$i<$rooms_k;$i++){
 						$new_rooms.=$rooms[$i];}
 						$fm=fopen("../local/datachat/rooms.dat","w");
 						flock($fm,LOCK_EX);
 						fputs($fm,"$new_rooms");
 						fflush($fm);
 						flock($fm,LOCK_UN);
 						fclose($fm);
 						chmod ("../local/datachat/rooms.dat", 0666);
 						header ("Location: achat.php?mess=down&".SID."");
 						exit;}
 						}
 			}
 			//--Вывод-комнат--//
 			echo 'Комнаты:<br />';
 			echo'&raquo;<a href="chat.php?'.SID.'">Первая комната</a><br>';
 			if (!file_exists("../local/datachat/rooms.dat")){
 				echo "Нет комнат<br />\r\n";
 				}
 				else
 				{
 					$datarooms=file("../local/datachat/rooms.dat");
 					$datarooms_k=count($datarooms);
 					if ($datarooms_k=='0'){
 						echo "Нет комнат<br />\r\n";}
 					for ($i=0;$i<$datarooms_k;$i++){
 						$room=explode(":||:",$datarooms[$i]);
 						$k_mess='0';
 						if (file_exists("../local/datachat/$room[0].chat")){
 							$chat=file("../local/datachat/$room[0].chat");
 							$k_mess=count($chat);}
 					echo "<div class=\"b\">";
 					echo "<a href=\"achat.php?id_room=$room[0]&amp;".SID."\"><b>$room[1]</b></a>";
 					echo " <a href=\"achat.php?act=rename&amp;id_room=$room[0]&amp;".SID."\">[Переименовать]</a>\r\n";
 					echo "<br />\r\n";
 					echo "<a href=\"achat.php?act=clear&amp;id_room=$room[0]&amp;".SID."\">[Очистить]</a>\r\n";
 					echo "<a href=\"achat.php?act=delroom&amp;id_room=$room[0]&amp;".SID."\">[Удалить]</a>\r\n";

 						if ($i!='0'){
 							echo "<a href=\"achat.php?act=up&amp;id_room=$room[0]&amp;".SID."\">[Вверх]</a>\r\n";}
 							if ($i!=$datarooms_k-1){
 								echo "<a href=\"achat.php?act=down&amp;id_room=$room[0]&amp;".SID."\">[Вниз]</a>\r\n";
 								}
 								echo "<br />\r\n";
 						if ($room[2]!='1'){
 						echo "<a href=\"achat.php?act=umn_add&amp;id_room=$room[0]&amp;".SID."\">[+Умник]</a>\r\n";}
 						else
 						{
 						echo "<a href=\"achat.php?act=umn_del&amp;id_room=$room[0]&amp;".SID."\">[-Умник]</a>\r\n";
 						}

 						if ($room[3]!='1'){
 						echo "<a href=\"achat.php?act=ves_add&amp;id_room=$room[0]&amp;".SID."\">[+Шутник]</a>\r\n";}
 						else
 						{
 						echo "<a href=\"achat.php?act=ves_del&amp;id_room=$room[0]&amp;".SID."\">[-Шутник]</a>\r\n";
 						}

 						if ($room[4]!='1'){
 						echo "<a href=\"achat.php?act=gal_add&amp;id_room=$room[0]&amp;".SID."\">[+Comedy]</a>\r\n";}
 						else
 						{echo "<a href=\"achat.php?act=gal_del&amp;id_room=$room[0]&amp;".SID."\">[-Comedy]</a>\r\n";}
 						print "<br />";
 						############################
 						### ВКЛЮЧАЕМ НОВЫХ БОТОВ ###
 						############################
 						if ($room[5]!='1'){
 						echo "<a href=\"achat.php?act=matbot_add&amp;id_room=$room[0]&amp;".SID."\">[+Пиздобол]</a>\r\n";
 						}
 						else
 						{
 						echo "<a href=\"achat.php?act=matbot_del&amp;id_room=$room[0]&amp;".SID."\">[-Пиздобол]</a>\r\n";
 						}
 						###################
 						if ($room[6]!='1'){
 						echo "<a href=\"achat.php?act=matvopr_add&amp;id_room=$room[0]&amp;".SID."\">[+Подъебки]</a>\r\n";
 						}
 						else
 						{
 						echo "<a href=\"achat.php?act=matvopr_del&amp;id_room=$room[0]&amp;".SID."\">[-Подъебки]</a>\r\n";
 						}
 						############################
 						### ВКЛЮЧАЕМ НОВЫХ БОТОВ ###
 						############################
 						echo "</div>\r\n";
 						echo "Сообщений: $k_mess<br />\r\n";
 						echo "<br />\r\n";}
 						}
 						echo "<hr />\r\n";
 						echo "<form action=\"achat.php?act=addroom&amp;".SID."\" method=\"post\" >\r\n";
 						echo "Новая комната:<br />\r\n";
 						echo "<input type=\"text\" name=\"newroom\" /><br /><br />\r\n";
 						echo "<input type=\"submit\" value=\"Добавить\" />\r\n";
 						echo "</form>\r\n";
 						echo'<br><br>';
 						echo '&laquo; <a href="../chat/?'.SID.'">В чат</a><br>';
 						echo'&raquo;<a href="index.php?'.SID.'">В админку</a><br>';
 						echo'&laquo;<a href="../index.php?'.SID.'">На главную</a><br>';
 //						}
 //						else{header ("Location: index.php?".SID."");exit;}
 //							echo '&laquo; <a href="../chat/?'.SID.'">В чат</a>';
 //							echo'<br>&raquo;<a href="index.php?'.SID.'">В админку</a><br>';
 //							echo'&laquo;<a href="../index.php?'.SID.'">На главную</a><br>';
 							}
 							else
 							{
 								header ("Location: ../index.php?error&".SID);
 								}
 } else {header ("Location: ../index.php?error&".SID);}
 								//} else {header ("Location: ../index.php?error&".SID);}
include_once"../themes/$config_themes/foot.php";
///////////////////////////////////////////////////////////////
//        autor: demon-6-6-6                                 //
//       e-mail: demon-6-6-6@mail.ru                         //
//          ICQ: 2387307                                     //
//         site: http://wap-class.org                        //
//       MOD BY: Godzilla                                    //
//       site: http://basaru.net.ru                          //
///////////////////////////////////////////////////////////////
?>