<?
include 'inclydings/gzips.php';
include 'mysql.php';
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
include 'mysql.php';
include_once("inclydings/zag.php");
include 'inclydings/ini.php';
include_once("inclydings/sesi.php");
if (isset($user)) {
switch($go) {

default:
$req = mysql_query("SELECT * FROM `rega` WHERE `chat` = '1' LIMIT 1");
////////////////////////////
if (mysql_num_rows($req)==1){echo"Чат временно закрыт администрацией!";}
$self = $_SERVER['SCRIPT_NAME'];
$ref=rand(100,100000);
include_once"inclydings/xtoonlinechat.php";
echo"<br/><br/><img src=\"pik4erspic/mini/ch.gif\"> <a href=\"chat.php?$sd&ref=$ref\">Обновить</a> <img src=\"pik4erspic/mini/sm.gif\"> <a href=\"faq.php?$sd&id=27\">Смайлы</a><br/>- - -<br/>";

echo "<form action=\"add.php?$sd\" method=\"post\">";
echo "<br/><input name=\"msg\" maxlength=\"500\" title=\"msg\"/><input type=\"hidden\" name=\"self\" value=\"$self\" />";
echo "<input type=\"submit\" value=\"Написать\"/></form><br/>";

$file = file("L2dbnam/esql2db/chat.dat");
$file = array_reverse($file);
$total = count($file);


for ($i = 0; $i < $total; $i++){
$data = explode("#",$file[$i]);
$data_0[]=$data[0];
$data_1[]=$data[1];
$data_4[]=$data[4];
}

if(empty($data_0)){echo"Сообщений нет."; include_once"inclydings/down.php"; exit;}

foreach($data_0 as $k=>$v)
{
if($data_4[$k]==$log){
$elita=mysql_query("SELECT * FROM `table_admin` WHERE `nick`='$data_1[$k]' LIMIT 1");
if(mysql_num_rows($elita)==1){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=lime><b>$data_1[$k]</b></font></a><b> [A]</b></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a><u>$data_0[$k]</u><hr>";}else{
$elita=mysql_query("SELECT * FROM `table_moder` WHERE `nick`='$data_1[$k]' LIMIT 1");
if(mysql_num_rows($elita)==1){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=blue><b>$data_1[$k]</b></font></a><b> [M]</b></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a><u>$data_0[$k]</u><hr>";}else{
$elita=mysql_query("SELECT * FROM `table_konsultant` WHERE `nick`='$data_1[$k]' LIMIT 1");
if(mysql_num_rows($elita)==1){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=#FFFAFA><b>$data_1[$k]</b></font></a><b> [K]</b></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a><u>$data_0[$k]</u><hr>";}else{
$elita=mysql_query("SELECT * FROM `table_vip` WHERE `nick`='$data_1[$k]' LIMIT 1");
if(mysql_num_rows($elita)==1){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=yellow>$data_1[$k]</font></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a><u>$data_0[$k]</u><hr>";}else{
if(@file("L2dbnam/esql2db/rating/olimpiads/$data_1[$k].dat")){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=#C71585>$data_1[$k]</font></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a>$data_0[$k]<hr>";}else{
if(@file("L2dbnam/esql2db/orange/$data_1[$k].dat")){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=#FFA500>$data_1[$k]</font></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a>$data_0[$k]<hr>";}else{
if(@file("L2dbnam/esql2db/LightGreen/$data_1[$k].dat")){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=#90EE90>$data_1[$k]</font></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a>$data_0[$k]<hr>";}else{
if(@file("L2dbnam/esql2db/colorroz/$data_1[$k].dat")){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=#FF1493> $data_1[$k]</font></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a>$data_0[$k]<hr>";}else{
$dat_screen[]="<a href=\"search.php?$sd&go=go&nick=$data_1[$k]\">$data_1[$k]</a>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a>$data_0[$k]<hr>";
}}}}}}}}}else{
$elita=mysql_query("SELECT * FROM `table_admin` WHERE `nick`='$data_1[$k]' LIMIT 1");
if(mysql_num_rows($elita)==1){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=lime><b>$data_1[$k]</b></font></a><b> [A]</b></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a><u>$data_0[$k]</u><hr>";}else{
$elita=mysql_query("SELECT * FROM `table_moder` WHERE `nick`='$data_1[$k]' LIMIT 1");
if(mysql_num_rows($elita)==1){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=blue><b>$data_1[$k]</b></font></a><b> [M]</b></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a><u>$data_0[$k]</u><hr>";}else{
$elita=mysql_query("SELECT * FROM `table_konsultant` WHERE `nick`='$data_1[$k]' LIMIT 1");
if(mysql_num_rows($elita)==1){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=#FFFAFA><b>$data_1[$k]</b></font></a><b> [K]</b></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a><u>$data_0[$k]</u><hr>";}else{
$elita=mysql_query("SELECT * FROM `table_vip` WHERE `nick`='$data_1[$k]' LIMIT 1");
if(mysql_num_rows($elita)==1){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=yellow>$data_1[$k]</font></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a><u>$data_0[$k]</u><hr>";}else{
if(@file("L2dbnam/esql2db/rating/olimpiads/$data_1[$k].dat")){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=#C71585>$data_1[$k]</font></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a>$data_0[$k]<hr>";}else{
if(@file("L2dbnam/esql2db/orange/$data_1[$k].dat")){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=#FFA500>$data_1[$k]</font></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a>$data_0[$k]<hr>";}else{
if(@file("L2dbnam/esql2db/LightGreen/$data_1[$k].dat")){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=#90EE90>$data_1[$k]</font></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a>$data_0[$k]<hr>";}else{

if(@file("L2dbnam/esql2db/colorroz/$data_1[$k].dat")){
$dat_screen[]="<a

href=\"search.php?$sd&nick=$data_1[$k]&go=go\"><font color=#FF1493>$data_1[$k]</font></a><b></b>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a>$data_0[$k]<hr>";}else{
$dat_screen[]="<a href=\"search.php?$sd&go=go&nick=$data_1[$k]\">$data_1[$k]</a>|<a href=\"say.php?$sd&nick=$data_1[$k]\">[отв]</a>$data_0[$k]<hr>";
}}}}}}}}}
}
if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + 10){ $end = $total; }
else {$end = $start + 10; }
for ($i = $start; $i < $end; $i++){


echo"$dat_screen[$i]";

}

if($total>0){

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

$asd=$start-(5*3);
$asd2=$start+(5*4);

if($asd<$total && $asd>0){echo ' <a href="chat.php?start=0&'.$sd.'">1</a> ... ';}

for($i=$asd; $i<$asd2;){

if($i<$total && $i>=0){
$ii=floor(1+$i/5);

if ($start==$i) {
echo ' <b>('.$ii.')</b>';
}else{
echo ' <a href="chat.php?start='.$i.'&'.$sd.'">'.$ii.'</a>';
}}
$i=$i+5;}
if($asd2<$total){echo ' ... <a href="chat.php?start='.$ba2.'&'.$sd.'">'.$ba.'</a>';}
}
$elita=mysql_query("SELECT * FROM `table_moder` WHERE `nick`='$log' LIMIT 1");
if(mysql_num_rows($elita)==1){
echo"<br/>[<a href=\"moder.php?$sd&go=chat\">Управление</a>]<br/>[<a href=\"moder.php?$sd&go=block\">Блокировать</a>]";
}
$elita=mysql_query("SELECT * FROM `table_admin` WHERE `nick`='$log' LIMIT 1");
if(mysql_num_rows($elita)==1){
echo"<br/>[<a href=\"gmaddmins.php?$sd&go=chat\">Управление</a>]<br/>[<a href=\"gmaddmins.php?$sd&go=block\">Блокировать</a>]";
}
break;
}
}else{echo"Пароль или ник неверен.Возможно сессия устарела.Попробуйте авторизироваться заново...";}
include 'inclydings/down.php';
?>
