Просмотр файла modules/guest/index.php

Размер файла: 11.76Kb
<?php
########################################
##	           WAP-ENGINE             ##
########################################
##                                    ##
##  Автор : CHUMA (Токарев Владимир)  ##
##  e-mail : [email protected]     ##
##  WAP : http://wap-engine.ru        ##
##                                    ##
########################################
##         ВЫ НЕ ИМЕЕТЕ ПРАВО         ##
##        ИЗМЕНЯТЬ КОД СКРИПТА        ##
##  ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ!  ##
########################################
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
$title_page = 'Гостевая';
$m_polozhenie = 'В гостевой';
include ("../../themes/$themes.php");
$login_in = $login;
$passw_in = $passw;
$status_in = $status;

####################
if ($portal=='off')
 {
  echo'<p align="center">'.$offmes.'</p>';
 }

if ($portal=='on')
 {

$data = file('../../data/gb.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">Гостевая</p>';

# Ошибка! Антифлуд
if($_GET['err'] == 'flood')
{
$gb_flood = '../../data/flood_gb.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_gb >= $flood_time)
{
$flood_sec = (trim($flood_arr[1]) + $antiflood_gb) - $flood_time;
break;
}
}
echo"<p class=\"err\">Флуд!!! Вы слишком часто пишите сообщения. В гостевую можно писать один раз в $antiflood_gb сек. Подождите еще $flood_sec сек.</p>";
}
# Ошибка! Антифлуд
if($_GET['err'] == 3)
{
echo"<p class=\"err\">Ошибка!!! Вы не ввели проверочное число.</p>";
}
if($_GET['err'] == 4)
{
echo"<p class=\"err\">Ошибка!!! Вы ввели неверно проверочное число.</p>";
}


echo "<p class=\"a\"><a href=\"add.php?".session_name()."=".session_id()."\">Написать</a> | ";
echo "<a href=\"./index.php?".session_name()."=".session_id()."\">Обновить</a><br /></p>";

if ($page_get < 0 || $page_get > $stranic && $stranic >=1)
{
echo "<p>Данной страницы несуществует!</p>";
}

if(empty($data))
{
echo "<p class=\"b\">В гостевой еще нет сообщений<br /></p><p></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=\"../../modules/kabinet/user_info.php?nick=$name_user[0]&amp;".session_name()."=".session_id()."\">$login_nick_color</a> ";
if($rating >= $kolbronza && $rating <= $kolserebro)
{
echo'<img src="/images/st/bronza.gif"alt=""/>';
}
if($rating >= $kolserebro && $rating <= $kolzoloto)
{
echo'<img src="/images/st/serebro.gif"alt=""/>';
}
if($rating >= $kolzoloto)
{
echo'<img src="/images/st/zoloto.gif"alt=""/>';
}
if($icon_text == "1" || $icon_text == "")
{
echo" <a href=\"add.php?for=$name_user[0]&amp;".session_name()."=".session_id()."\"><img src=\"/images/st/g.gif\"align=\"top\"alt=\"\"title=\"Ответить\"></a> ";

if (isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in)
{
echo" <a href=\"../../modules/kabinet/send_privat.php?nick=$name_user[0]&amp;".session_name()."=".session_id()."\"><img src=\"/themes/chuma/1.gif\"align=\"top\" alt=\"\"title=\"Написать сообщение\"></a> ";
}
}
if($icon_text == "0")
{
echo" <a href=\"add.php?for=$name_user[0]&amp;".session_name()."=".session_id()."\">[Отв]</a> ";

if (isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in)
{
echo" <a href=\"../../modules/kabinet/send_privat.php?nick=$name_user[0]&amp;".session_name()."=".session_id()."\">[ЛС]</a> ";
}
}

}
else
{
echo "<p class=\"b\"><img src=\"/themes/chuma/opros.gif\"alt=\"\"> $name_user[0]";
}
echo "<br />($date_user / $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].'';
}
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">';
echo "<font color=\"$color_red\">$device_user [$ip_user]</font><br />";

if($status_in == "1")
{
echo "[<a href=\"admin.php?act=ans&amp;str=$i&amp;for=$name_user[0]&amp;page=$page_get&amp;".session_name()."=".session_id()."\">Ответ</a>]";
}
echo "[<a href=\"admin.php?act=del&amp;str=$i&amp;page=$page_get&amp;".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете удаление?')\">Удал</a>]";
echo "[<a href=\"admin.php?act=ban&amp;ban=$device_user||$ip_user&amp;".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете бан IP?')\">Бан IP</a>]";
if($name_user[0] != 'Гость')
{
echo "[<a href=\"admin.php?act=banuser&amp;ban=$name_user[0]&amp;".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.php?page=1&amp;".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.php?page=$i&amp;".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.php?page=$i&amp;".session_name()."=".session_id()."\">$i</a>";
}

if($stranic > $page_get && $page_get < ($stranic-3))
{
echo "...<a href=\"index.php?page=$stranic&amp;".session_name()."=".session_id()."\">$stranic</a>";
}
echo "<br />";

if($page_get > 1)
{
echo "<a href=\"index.php?page=$page_nazad&amp;".session_name()."=".session_id()."\">Назад</a>";
}
echo " | ";
if($stranic > $page_get)
{
echo "<a href=\"index.php?page=$page_dalee&amp;".session_name()."=".session_id()."\">Дальше</a>";
}
echo "</p>";
}
echo "<p align=\"center\">В гостевой $count сообщений.<br />";
if (isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in && ($status_in == "1"))
{
echo "<a href=\"admin.php?act=clearguest&amp;".session_name()."=".session_id()."\"onclick=\"return confirm('Вы подтверждаете?')\">Очистить гостевую</a><br /></p>";
}
}
####################
if(isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in)
{
echo "<form action=\"send.php?".session_name()."=".session_id()."\" method=\"post\">";
echo "<p class=\"b\" align=\"center\">Сообщение:<br />
<textarea rows=\"4\" cols=\"15\" name=\"msg\"></textarea><br />";
if($trans == '1')
{
echo"<input type=\"checkbox\" name=\"msgtrans\" value=\"1\" /> Транслит
<br />";
}
echo"<input type=\"submit\" value=\"Написать\" /></p>
</form>";
}
elseif($dostup_guest == "1")
{
$rand = rand(1000, 9999);
$_SESSION['rand'] = $rand;
echo "<form action=\"send.php?".session_name()."=".session_id()."\" method=\"post\">";
echo "<p class=\"b\" align=\"center\">Вы: Гость<br />
Сообщение:<br />
<textarea rows=\"4\" cols=\"15\" name=\"msg\"></textarea><br />";
if($trans == '1')
{
echo"<input type=\"checkbox\" name=\"msgtrans\" value=\"1\" /> Транслит
<br />";
}
echo"Число <font color=\"red\">$rand</font>:<br /><input size=\"4\" maxlength=\"4\" name=\"imgrand\" value=\"\" /><br />
<input type=\"submit\" value=\"Написать\" /></p>
</form>";
}
####################
}
else
{
echo"<p align=\"center\">Ошибка!!!<br />";
}
####################
}
include ('../../templates/foot.php');
?>