File size: 9.78Kb
<?php
########################################
## WAP-ENGINE ##
########################################
## ##
## Автор : CHUMA (Токарев Владимир) ##
## e-mail : [email protected] ##
## WAP : http://wap-engine.ru ##
## ##
########################################
## ВЫ НЕ ИМЕЕТЕ ПРАВО ##
## ИЗМЕНЯТЬ КОД СКРИПТА ##
## ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ! ##
########################################
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
include ('../../modules/chat/config.php');
$title_page = 'Чат - '.$room2.'';
$m_polozhenie = 'Чат - '.$room2.'';
include ('../../modules/chat/online.php');
include ("../../themes/$themes.php");
echo'<meta http-equiv="Refresh" content="'.$autoupdate_ch.'" />';
$login_in = $login;
$passw_in = $passw;
$status_in = $status;
####################
if ($portal=='off')
{
echo'<p align="center">'.$offmes.'</p>';
}
if ($portal=='on')
{
$data = file('../../data/chat/2.txt');
$count = count($data);
$kolmes = $guestmes;
$stranic = ceil($count/$kolmes);
$users_on_f = file('../../data/user_online.txt');
$user_on_arr = implode('|', $users_on_f);
####################
if(empty($_GET['page']))
{
$page_get = 1;
}
else
{
$page_get = $_GET['page'];
}
if($page_get < 0)
{
$page_get = 1;
}
if($page_get > $stranic)
{
$page_get = $stranic;
}
$do = $kolmes * ($page_get - 1);
$end = $kolmes * $page_get;
$page_nazad = $page_get - 1;
$page_dalee = $page_get + 1;
if (preg_match("#^[0-9]*$#", $page_get))
{
echo '<p class="modul_name"align="center">'.$room2.'</p>';
if(!empty($top2))
{
echo"<p class=\"b\"align=\"center\">$top2<br /></p>";
}
# Ошибка! Антифлуд
if($_GET['err'] == 'flood')
{
$gb_flood = '../../data/flood_chat.txt';
$gb_flood_list = file($gb_flood);
$flood_time = time();
$ip = filter($_SERVER['REMOTE_ADDR']);
$flood_sec = 0;
foreach ($gb_flood_list as $key => $string)
{
$flood_arr = explode('|', $string);
if(trim($flood_arr[0]) == $ip && trim($flood_arr[1]) + $antiflood_chat >= $flood_time)
{
$flood_sec = (trim($flood_arr[1]) + $antiflood_chat) - $flood_time;
break;
}
}
echo"<p class=\"err\">Флуд!!! Вы слишком часто пишите сообщения. В чат можно писать один раз в $antiflood_chat сек. Подождите еще $flood_sec сек.</p>";
}
# Ошибка! Антифлуд
if(isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in)
{
echo "<form action=\"send_2.php?\"method=\"post\"><p class=\"a\"><a href=\"add_2.php?".session_name()."=".session_id()."\">Сказать</a> |";
echo " <a href=\"./index_2.php?".session_name()."=".session_id()."\">Обновить</a><br />";
echo"<input name=\"msg\"size=\"14\"value=\"\"/><input value=\"ОК\"type=\"submit\"/></form><br /></p>";
if ($page_get < 0 || $page_get > $stranic && $stranic >=1)
{
echo "<p>Данной страницы несуществует!</p>";
}
if(empty($data))
{
echo "<p class=\"b\">В этой комнате еще нет сообщений.<br /></p>";
}
else
{
for ($i = $do; $i < $end; $i++)
{
if (!empty($data[$i]))
{
$viewmess = explode('|', $data[$i]);
$name_user = $viewmess[0];
$for_user = $viewmess[1];
$device_user = $viewmess[2];
$ip_user = $viewmess[3];
$time_user = $viewmess[4];
$date_user = $viewmess[5];
$mess_user = $viewmess[6];
$mess_admin1 = $viewmess[7];
$mess_admin2 = $viewmess[8];
$mess_admin3 = $viewmess[9];
$name_user = nick_user($name_user);
if($name_user[0] != 'Гость')
{
user_data('../../data/users/'.trim($name_user[0]).'.php');
echo "<p class=\"b\">";
if(strstr($user_on_arr, '|'.trim($name_user[0]).'|'))
{
if($pol == '1')
{
if($status == '5')
{
echo'<img src="/images/st/m_nov.gif"alt=""/>';
}
elseif($status == '4')
{
echo'<img src="/images/st/m.gif"alt=""/>';
}
elseif($status == '3')
{
echo'<img src="/images/st/mod_m.gif"alt=""/>';
}
elseif($status == '2')
{
echo'<img src="/images/st/gmod_m.gif"alt=""/>';
}
elseif($status == '1')
{
echo'<img src="/images/st/admin_m.gif"alt=""/>';
}
}
elseif($pol == '0')
{
if($status == '5')
{
echo'<img src="/images/st/w_nov.gif"alt=""/>';
}
elseif($status == '4')
{
echo'<img src="/images/st/w.gif"alt=""/>';
}
elseif($status == '3')
{
echo'<img src="/images/st/mod_w.gif"alt=""/>';
}
elseif($status == '2')
{
echo'<img src="/images/st/gmod_w.gif"alt=""/>';
}
elseif($status == '1')
{
echo'<img src="/images/st/admin_w.gif"alt=""/>';
}
}
}
else
{
if($pol == '1')
{
echo'<img src="/images/st/m_off.gif"alt=""/>';
}
elseif($pol == '0')
{
echo'<img src="/images/st/w_off.gif"alt=""/>';
}
}
$nick_name_arr = explode('::', $nickname);
$nickname = $nick_name_arr[0];
$nickcolor = $nick_name_arr[1];
if(!empty($nickname))
{
if(!empty($nickcolor))
{
$login_nick_color = '<font color="'.$nickcolor.'">'.$nickname.'</font>';
}
else
{
$login_nick_color = ''.$nickname.'';
}
}
else
{
$login_nick_color = ''.$name_user[0].'';
}
echo" <a href=\"add_2.php?for=$name_user[0]&".session_name()."=".session_id()."\">$login_nick_color</a> ";
}
else
{
echo "<p class=\"b\"><img src=\"/themes/chuma/opros.gif\"alt=\"\"> $name_user[0] ";
}
echo"($time_user)<br />";
if(!empty($for_user))
{
$for_user = nick_user($for_user);
user_data('../../data/users/'.trim($for_user[1]).'.php');
$nick_name_arr = explode('::', $nickname);
$nickname = $nick_name_arr[0];
$nickcolor = $nick_name_arr[1];
if(!empty($nickname))
{
if(!empty($nickcolor))
{
$login_nick_color = ''.$nickname.'';
}
else
{
$login_nick_color = ''.$nickname.'';
}
}
else
{
$login_nick_color = ''.$for_user[1].'';
}
if($for_user[1] == $login_in)
{
echo "<font color=\"red\"><b>$login_nick_color</font>,</b> ";
}
else
{
echo "<b>$login_nick_color,</b> ";
}
}
echo"".antimat($mess_user)."<br />";
if (!empty($mess_admin1))
{
$nickadmina_f = file('../../data/users/'.$nickadmina.'.php');
$nickadmina_name = trim($nickadmina_f[37]);
$nickadmina_name_arr = explode('::', $nickadmina_name);
if(!empty($nickadmina_name_arr[0]))
{
$nickadmina_name_user = $nickadmina_name_arr[0];
$nickadmina_name_color = $nickadmina_name_arr[1];
if(!empty($nickadmina_name_color))
{
$nickadmina_show = '<font color="'.$nickadmina_name_color.'">'.$nickadmina_name_user.'</font>';
}
else
{
$nickadmina_show = $nickadmina_name_user;
}
}
else
{
$nickadmina_show = $nickadmina;
}
echo "<font color=\"$color_red\">Админ $nickadmina_show: $mess_admin1</font><br />";
}
if (!empty($mess_admin2))
{
echo "<font color=\"$color_red\">Админ $nickadmina_show: $mess_admin2</font><br />";
}
if (!empty($mess_admin3))
{
echo "<font color=\"$color_red\">Админ $nickadmina_show: $mess_admin3</font><br />";
}
echo'</p>';
if (isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in && ($status_in == "1" || $status_in == "2" || $status_in == "3"))
{
echo "<p class=\"dy\"><font color=\"$color_red\">$device_user [$ip_user]</font><br />";
echo "[<a href=\"admin_2.php?act=del&str=$i&page=$page_get&".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете удаление?')\">Удал</a>]";
echo "[<a href=\"admin_2.php?act=ban&ban=$device_user||$ip_user&".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете бан IP?')\">Бан IP</a>]";
if($name_user[0] != 'Гость')
{
echo "[<a href=\"admin_2.php?act=banuser&ban=$name_user[0]&".session_name()."=".session_id()."\">Бан</a>]";
}
echo "</p>";
}
}
}
if($stranic > 1)
{
echo "<p align=\"center\" class=\"d\">";
echo "Страницы:";
echo "<br />";
if($page_get > 4)
{
echo "<a href=\"index_2.php?page=1&".session_name()."=".session_id()."\">1</a>...";
}
$start_1 = $page_get - 3;
$end_1 = $page_get - 1;
if($start_1 < 1)
{
$start_1 = 1;
}
for($i = $start_1; $i <= $end_1; $i++)
{
echo"<a href=\"index_2.php?page=$i&".session_name()."=".session_id()."\">$i</a> ";
}
echo"$page_get";
$start_2 = $page_get + 1;
$end_2 = $page_get + 3;
if($start_2 < 1)
{
$start_2 = 1;
}
if($end_2 > $stranic)
{
$end_2 = $stranic;
}
for($i = $start_2; $i <= $end_2; $i++)
{
echo" <a href=\"index_2.php?page=$i&".session_name()."=".session_id()."\">$i</a>";
}
if($stranic > $page_get && $page_get < ($stranic-3))
{
echo "...<a href=\"index_2.php?page=$stranic&".session_name()."=".session_id()."\">$stranic</a>";
}
echo "<br />";
if($page_get > 1)
{
echo "<a href=\"index_2.php?page=$page_nazad&".session_name()."=".session_id()."\">Назад</a>";
}
echo " | ";
if($stranic > $page_get)
{
echo "<a href=\"index_2.php?page=$page_dalee&".session_name()."=".session_id()."\">Дальше</a>";
}
echo "</p>";
}
echo "<p align=\"center\"class=\"b\">В комнате $count сообщений.<br />";
}
if (isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in && ($status_in == "1" || $status_in == "2"))
{
echo "<a href=\"admin_2.php?act=clear&".session_name()."=".session_id()."\"onclick=\"return confirm('Вы подтверждаете?')\">Очистить комнату</a><br />";
}
echo"</p>";
####################
echo'<p><a href="index.php">Выбрать другую комнату</a><br></p>';
}
else
{
echo"<p class=\"b\">Ошибка!!! Вы не авторизованы. Войдите в личный кабинет.</p>";
}
####################
}
else
{
echo"<p align=\"center\">Что хотел взломать мой сайт?<br />";
}
####################
}
include ('../../templates/foot.php');
?>