Файл: region_clean/history.php
Строк: 296
<?
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################
require_once "start.php";
require_once "sid.php";
header("Cache-Control: no-cache");
if ($ver == "wml")header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");
require_once "inc.php";
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require_once "version.php";
if ($rm != 23) {
if (isset($_GET['rm'])) { $rm = $_GET['rm']; }
if (!ctype_digit($rm)) { header("Location: index.php?isset=403"); }
$rm = intval($rm);
mysql_query ("Select rm from rooms where rm='".$rm."';");
if (mysql_affected_rows() == 0) {
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>
<card id="error" title="Ошибка" ontimer="enter.php?$ses&ref=$ref"><timer value="15"/>
<p align="center">";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Ошибка</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="center">";
}
echo $fsize1;
echo 'Такой комнаты не существует!<br/>';
echo $fsize2;
if ($ver == "wml") echo '</p></card></wml>';
include_once "foot.php";
}
if (($row['level'] < 4) and ($rm == 8)) {
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>
<card id="error" title="Внимание!!!" ontimer="enter.php?$ses&ref=$ref"><timer value="15"/>
<p align="center">";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>Внимание!!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="center">";
}
echo $fsize1;
echo 'Извини, но в эту комнату тебе доступ закрыт!<br/>';
echo $fsize2;
include_once "foot.php";
exit;
}
$smset = $row['smiles'];
$us = $row['user'];
$room = "room" . $rm;
if ($rm == 10) $takep="&pwd=$pwd&ref=$ref";
else if ($mod == "privat") $takep="&mod=$mod&ref=$ref";
else $takep="&ref=$ref";
$max = $row['max'];
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
<card id="history" title="История">n
<do type="options" name="refresh" label="Обновить"><go href="chat.php?$ses&rm=$rm$takep"/></do>n
<p mode="wrap">n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>История</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="left">";
}
echo $fsize1;
if ($ver == "wml") {
echo "<a href="chat.php?$ses&rm=$rm$takep">Сказать</a><br/>n
<a href="chat.php?$ses&rm=$rm$takep">Обновить</a><br/>---n";
} else {
echo "<div class = 'd1'><a href="add.php?$ses&mod=chat&rm=$rm$takep">Сказать</a><br/>n
<a href="chat.php?$ses&rm=$rm$takep">Обновить</a></div><br/>n";
}
if (!isset($num)) $num = 0;
$bmax = $max * 2;
$bnum = $num + 1;
if (empty($pwd)) $pwd = intval($pwd);
if ($rm == 10)
$res = mysql_query ("Select
klu4,time,who,message,messagewosm,messagewoasm,id,towhom,hid,usid,pwd,komu from room10
".($row['level'] == 8 ? null : "WHERE ((pwd = '".$pwd."') OR (pwd = '')) and ((usid = '".$id."') OR (towhom = '".$id."') OR (towhom = ''))")."
order by id desc LIMIT $bnum,$bmax");
elseif ($mod == "privat") $res = mysql_query ("Select
klu4,time,who,message,messagewosm,messagewoasm,id,towhom,hid,usid,komu from $room
WHERE ".($row['level'] == 8 ? "towhom!=''" : " (usid = '".$id."') OR (towhom = '".$id."') ")."
order by id desc LIMIT $bnum,$bmax");
else $res = mysql_query ("Select
klu4,time,who,message,messagewosm,messagewoasm,id,towhom,hid,usid,komu from $room
".($row['level'] == 8 ? null : " WHERE (usid = '".$id."') OR (towhom = '".$id."') OR (towhom = '')")."
order by id desc LIMIT $bnum,$bmax");
$kol = mysql_affected_rows();
@$total = $kol;
$mread = 0;
while ($mread < $max) {
$data = mysql_fetch_array($res);
if ($data === false)
break;
$komu = $data['komu'];
$date = $data['time'];
$klu4 = $data['klu4'];
$inkognit = "Аноним";
$inkognit = trim(htmlspecialchars(stripslashes($inkognit)));
if ($rm == 13) $name = $inkognit;
else $name = $data['who'];
$usid = $data['usid'];
$msg = $data['message'];
if ($smset == 0 and $data['messagewosm'] != '') $msg = $data['messagewosm'];
if ($smset == 2 and $data['messagewoasm'] != '') $msg = $data['messagewoasm'];
$time = $data['id'];
$th = $data['towhom'];
$hid = $data['hid'];
mysql_query ("Select * from ignor where usid='".(int)$usid."' and id='".$id."'");
if ((mysql_affected_rows() == false) and (($hid != 2) or ($id == $usid))) {
if ($th == '') {
if (!empty($komu)) {
if ($us == $komu) $komu = "<b>".$komu."</b>, ";
else $komu = $komu . ", ";
}
if ($row['picpol'] == 1) {
$kart = '<img src = "icon/0.png" alt="x"/>';
$kart2 = '<img src = "icon/1.png" alt="x"/>';
}
if ($rm == 13 && $row['level'] > 5) { echo '<br/><b>'.col_n($name).'</b> ('.$date.') <a href="delmess.php?'.$ses.'&rm='.$rm.'&klu4='.$klu4.$takep.'">[X]</a>>'.$msg; $mread++;
} elseif ($rm == 13 && $row['level'] < 5) {
echo '<br/><b>'.col_n($name).'</b> ('.$date.') '.$msg; $mread++;
} else {
if ($row['level'] < 5) {
if ($ver == "wml") {
echo "<br/><b><a href="inside.php?$ses&rm=$rm&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.")> ".$komu."n".$msg; $mread++;
} else {
if ($sex == "М") {
echo "<br/>".$kart2." <b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.")> ".$komu."n".$msg; $mread++;
}
else
{
echo "<br/>".$kart." <b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.")> ".$komu."n".$msg; $mread++;
}
}
} else {
if ($ver == "wml") {
echo "<br/><b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.")> ".$komu."n".$msg;
} else {
if ($sex == "М") {
echo "<br/>".$kart2." <b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.") <a href="delmess.php?$ses&rm=$rm&klu4=$klu4$takep">[X]</a>> ".$komu."".$msg; $mread++;
}
else
{
echo "<br/>".$kart." <b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.") <a href="delmess.php?$ses&rm=$rm&klu4=$klu4$takep">[X]</a>> ".$komu."".$msg; $mread++;
}
}
#echo "<a href="delmess.php?$ses&rm=$rm&klu4=$klu4$takep">[X]</a>n".$msg;
#$mread++;
}
}
}
elseif ((($th == $id) or ($id == $usid)) or $row['level'] == 8) {
if (!empty($komu)) {
if ($us == $komu) $komu = "<b>".$komu."</b>, ";
else $komu = $komu . ", ";
}
if ($row['picpol'] == 1) {
$kart = '<img src = "icon/0.png" alt="x"/>';
$kart2 = '<img src = "icon/1.png" alt="x"/>';
}
if ($row['level'] < 5) {
if ($ver == "wml") {
echo "<br/><b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.") <b>[P!]</b>> ".$komu."n".$msg; $mread++;
} else {
if ($sex == "М") {
echo "<br/>".$kart2." <b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.") <b>[P!]</b>> ".$komu."n".$msg; $mread++;
}
else
{
echo "<br/>".$kart." <b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.") <b>[P!]</b>> ".$komu."n".$msg; $mread++;
}
}
} else {
if ($ver == "wml") {
echo "<br/><b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.") <b>[P!]</b> <a href="delmess.php?$ses&rm=$rm&klu4=$klu4$takep">[X]</a>> ".$komu."".$msg; $mread++;
} else {
if ($sex == "М") {
echo "<br/>".$kart2." <b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.") <b>[P!]</b> <a href="delmess.php?$ses&rm=$rm&klu4=$klu4$takep">[X]</a>> ".$komu."".$msg; $mread++;
}
else
{
echo "<br/>".$kart." <b><a href="inside.php?$ses&rm=$rm&nk=$usid$takep">".col_n($name)."</a></b> (".$date.") <b>[P!]</b> <a href="delmess.php?$ses&rm=$rm&klu4=$klu4$takep">[X]</a>> ".$komu."".$msg; $mread++;
}
}
#echo "<a href="delmess.php?$ses&rm=$rm&klu4=$klu4$takep">[X]</a>n".$msg;
#$mread++;
}
}
}
}
mysql_close($link);
if ($ver == "wml") echo '<br/>---';
else echo '<br/><br/>';
$page_next = $num + $max;
$page_prev = $num - $max;
if ($num == 0) $total + 1;
if ($max < $total and $num >= $max and $ver == "wml") {
echo "<br/><a href="history.php?$ses&rm=$rm&num=$page_next$takep">След. $max</a>
<br/><a href="history.php?$ses&rm=$rm&num=$page_prev$takep">Пред. $max</a>
<br/><a href="enter.php?$ses&ref=$ref">Прихожая</a><br/>";
}
elseif ($max < $total and $num >= $max and $ver == "xhtml") {
echo "<div class = 'd1'><a href="history.php?$ses&rm=$rm&num=$page_next$takep">След. → $max</a><br/>
<a href="history.php?$ses&rm=$rm&num=$page_prev$takep">← Пред. $max</a><br/>
<a href="enter.php?$ses&ref=$ref">← Прихожая</a></div>";
}
else
{
echo "<div class = 'd1'><a href="history.php?$ses&rm=$rm&num=$page_prev$takep">← Пред. $max</a><br/>
<a href="enter.php?$ses&ref=$ref">← Прихожая</a></div>";
}
echo $fsize2;
include_once 'foot.php';
} else {
if (isset($_GET['rm'])) { $rm = $_GET['rm']; }
if (!ctype_digit($rm)) { header("Location: index.php?isset=403"); die; }
$rm = intval($rm);
$rmaf = "room" . $rm;
$ringame = "ingame" . $rm;
$us = $row['user'];
$smset = $row['smiles'];
mysql_query ("select * from $ringame WHERE gamer_id = '".$id."'");
if (mysql_affected_rows() != 0) $gmes = 1;
else $gmes = 0;
$max = $row['max'];
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
<card id="history" title="История">n
<do type="options" name="refresh" label="Обновить"><go href="chat.php?$ses&rm=$rm$takep"/></do>n
<p mode="wrap">n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="css/$css.css"/>
<title>История</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="left">";
}
echo $fsize1;
if ($ver == "wml") {
echo "<a href="chat.php?$ses&rm=$rm$takep">Сказать</a><br/>n
<a href="chat.php?$ses&rm=$rm$takep">Обновить</a><br/>---n";
} else {
echo "<div class = 'd1'><a href="add.php?$ses&mod=chat&rm=$rm$takep">Сказать</a><br/>n
<a href="chat.php?$ses&rm=$rm$takep">Обновить</a></div><br/>n";
}
$res = mysql_query ("Select * from $rmaf order by id desc LIMIT 400");
$kol = mysql_affected_rows();
@$total = $kol;
if (!isset($num)) $num = 0;
$mread = $num;
for ($i = 1; $i <= $num; $i++) $data = mysql_fetch_array($res);
$i = $num;
while (($mread < $num+$max) && ($i <= $total)) {
$data = mysql_fetch_array($res);
$komu = $data['komu'];
$date = $data['time'];
$inkognit = "Аноним";
if ($rm == 13) $name = $inkognit;
else $name = $data['who'];
$usid = $data['usid'];
$msg = $data['message'];
$gm = $data['gamemes'];
if ($smset == 0 and $data['messagewosm'] != '') $msg = $data['messagewosm'];
if ($smset == 2 and $data['messagewoasm'] != '') $msg = $data['messagewoasm'];
$time = $data['id'];
$th = $data['towhom'];
$hid = $data['hid'];
$i++;
mysql_query ("Select * from ignor where usid='".(int)$usid."' and id='".$id."'");
if ((mysql_affected_rows() == false) and (($hid != 2) or ($id == $usid)) and ($gmes == 0 or ($gmes == 1 and $gm == 1))) {
if (!empty($komu)) {
if ($us == $komu) $komu = "<b>".$komu."</b>, ";
else $komu = $komu . ", ";
}
if ($row['picpol'] == 1) {
$kart = '<img src = "icon/0.png" alt="x"/>';
$kart2 = '<img src = "icon/1.png" alt="x"/>';
}
if ($rm == 13 && $row['level'] > 5) { echo '<br/><b>'.col_n($name).'</b> ('.$date.') <a href="delmess.php?'.$ses.'&rm='.$rm.'&klu4='.$klu4.$takep.'">[X]</a>>'.$msg; $mread++;
} elseif ($rm == 13 && $row['level'] < 5) {
echo '<br/><b>'.col_n($name).'</b> ('.$date.') '.$msg; $mread++;
} else {
if ($th == '') {
echo "<br/><b><a href="inside.php?$ses&nk=$usid&rm=$rm&ref=$ref">".col_n($name)."</a></b> (".$date.") ".$komu."n".$msg;
$mread++;
}
else if (($th == $id) or ($id == $usid)) {
echo "<br/><b><a href="inside.php?$ses&nk=$usid&rm=$rm&ref=$ref">".col_n($name)."</a></b> (".$date.") <b>[P!]</b>> ".$komu."n".$msg;
$mread++;
}
}
}
}
mysql_close ($link);
if ($ver == "wml") echo '<br/>---';
else echo '<br/><br/>';
$page_next = $num + $max - 1;
$page_prev = $num - $max + 1;
if ($max < $total and $num >= $max and $ver == "wml") {
echo "<br/><a href="history.php?$ses&rm=$rm&num=$page_next$takep">След. $max</a>
<br/><a href="history.php?$ses&rm=$rm&num=$page_prev$takep">Пред. $max</a>
<br/><a href="enter.php?$ses&ref=$ref">Прихожая</a><br/>";
}
elseif ($max < $total and $num >= $max and $ver == "xhtml") {
echo "<div class = 'd1'><a href="history.php?$ses&rm=$rm&num=$page_next$takep">След. → $max</a><br/>
<a href="history.php?$ses&rm=$rm&num=$page_prev$takep">← Пред. $max</a><br/>
<a href="enter.php?$ses&ref=$ref">← Прихожая</a></div>";
}
else
{
echo "<div class = 'd1'><a href="history.php?$ses&rm=$rm&num=$page_prev$takep">← Пред. $max</a><br/>
<a href="enter.php?$ses&ref=$ref">← Прихожая</a></div>";
}
echo $fsize2;
include_once 'foot.php';
}
?>