Просмотр файла ilichat_exclusive/add.php

Размер файла: 4.87Kb
<?php
error_reporting(0);
include('start.php');
include("config.php");
include("./includes/constants/add");
include("./includes/".$ver."/banned");

$bots = file("bots/bots.dat");
$ttl="Сказать";
$nocache = rand(10000, 99999);

list($msec, $sec) = explode(chr(32), microtime()); 
$headtime = $sec + $msec;

switch($ver)
{
////////////////////////////////////////////////////////
//WML VERSION
////////////////////////////////////////////////////////
case 'wml':
header("Content-type:text/vnd.wap.wml; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");

//AUTH
$id = intval($_SESSION['id']);
$password = mysql_escape_string($_SESSION['password']);
$q = mysql_query("SELECT * FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");

if(mysql_affected_rows() == 0)
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
echo "<card title=\"Ошибка\" ontimer=\"index.php?ver=wml\"><timer value=\"15\"/><p align=\"left\">\n";
echo "<small>Ошибка авторизации!<br/>\n";
echo "<br/>$wmlfoot";
echo "</small></p></card></wml>";
exit();
}
else
{
$user = mysql_fetch_array($q);
$kick = $user['kick'];
$moder = $user['moder'];
$reason = $user['reason'];
}
//END AUTH

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
echo "<card title=\"Ошибка\" ontimer=\"menu.php?".SID."&amp;ver=wml\"><timer value=\"15\"/><p align=\"left\">\n";
echo "<small>".VERSION_ERROR."<br/>\n";
echo "<br/>$wmlfoot";
echo "</small></p></card></wml>";
break;

////////////////////////////////////////////////////////
//HTML VERSION
////////////////////////////////////////////////////////
case 'html':
header ("Content-type: text/html; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");

//AUTH
$id = intval($_SESSION['id']);
$password = mysql_escape_string($_SESSION['password']);
$q = mysql_query("SELECT * FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");
if(mysql_num_rows($q) == 0)
{
echo "$css";
echo'<title>'.$ttl.'</title>';
echo'<div class="d3">Ошибка</div>';
echo "<div class=\"d5\">Ошибка авторизации!</div>\n";
echo'<div class="d3">';
echo"$sitefoot";
echo'</div>';
echo "</body></html>";
exit();
}
else
{
$user = mysql_fetch_array($q);
$kick = $user['kick'];
$moder = $user['moder'];
$reason = $user['reason'];
$ban = $user['ban'];
$level = $user['level'];
$translit = $user['translit'];
$fsize = $user['fsize'];
$emotions = $user['emotions'];
}
//END AUTH
$rid = intval($_GET['rid']);

$sql = mysql_query("SELECT * FROM `chat_rooms` WHERE `id` = '".$rid."';");

if(mysql_affected_rows() == 0)
{
echo "$css";
echo'<title>'.$ttl.'</title>';
echo'<div class="d3">Ошибка</div>';
echo "<div class=\"d5\">Такой комнаты не существует.</div>\n";
echo'<div class="d3">';
echo"$sitefoot";
echo'</div>';
echo "</body></html>";
exit();
}

if($kick > time())
{
echo "$css";
echo'<title>'.$ttl.'</title>';
echo'<div class="d3">Ошибка</div>';
echo "<div class=\"d5\">Вы Забаненны модератором <u>$moder</u>. Разбан будет через <u>".($kick - time())."</u> сек.<br/>\n";
echo "Причина: $reason</div>\n";
echo'<div class="d3">';
echo"$sitefoot";
echo'</div>';
echo "</body></html>";
exit();
}

//ONLINE
$online = time() + 60;
$update = mysql_query("UPDATE `chat_users` SET `time` = '".$online."', `place` = '".$rid."', `ip` = '".getenv('REMOTE_ADDR')."', `ua` = '".htmlspecialchars(getenv('HTTP_USER_AGENT'))."' WHERE `id` = '".$id."';");
//END ONLINE

if($fsize == 0)
{
$fsize = "small";
}
if($fsize == 1)
{
$fsize = "normal";
}
if($fsize == 2)
{
$fsize = "large";
}
echo "$css";
echo'<title>'.$ttl.'</title>';
echo'<div class="d3">'.$ttl.'</div>';
echo "<form action=\"room.php?".SID."&amp;ver=html&amp;rid=$rid&amp;nocache=$nocache\" method=\"post\">\n";
echo "<input type=\"text\" name=\"msg\" maxlength=\"300\" value=\"\"/>";
if($translit == 1)
{
echo "Транслитировать:\n";
echo "<input type=\"checkbox\" name=\"translit\" value=\"true\" checked=\"checked\" /><br/>\n";
}
echo "<input type=\"submit\" value=\"Сказать\" /></form></div>\n";
echo "<div class=\"d1\">• <a href=\"room.php?".SID."&amp;ver=html&amp;rid=$rid&amp;nocache=$nocache\">В чат</a><br/>\n";
echo "• <a href=\"menu.php?".SID."&amp;ver=html&amp;nocache=$nocache\">В прихожую</a></div>\n";
echo'<div class="d3">';
echo"$sitefoot";
echo'</div>';
echo "</body></html>";
break;
}
?>