Файл: [BESTSKRIPT.COM]_script2/script2/chat1.php
Строк: 227
<?php
session_start();
include("connect.php");
$user=$_SESSION["user"];
// Процесс авторизации и вывода данных о пользователе
if ($user!="") {
$sqlus="SELECT * FROM tb_users WHERE login='$user'";
$resultus=mysql_query($sqlus);
$rowus=mysql_fetch_array($resultus);
}
?>
<style type="text/css">
a {color:#ff0000; font-size:9pt; font-family:arial; text-decoration: none;}
a:hover {color:#990000; text-decoration: none;}
a.mod {color:#999999; font-size:9pt; font-family:arial; text-decoration: none;}
a.mod:hover {color:#ff0000; text-decoration: none;}
a.msg1 {color:#000000; font-size:9pt; font-family:arial; text-decoration: none;}
a.msg1:hover {color:#000000; text-decoration: none;}
a.link {color:#0000ff; font-size:9pt; font-family:arial; text-decoration: none;}
a.link:hover {color:#00cc00; text-decoration: none;}
body {
font-size:9pt;
font-family:arial;
}
table {
font-size:9pt;
font-family:arial;
}
</style>
<script>
function msgto(str){
obj = parent.chattextarea.text;
obj.focus();
obj.value = obj.value + str;
}
</script>
<body bgcolor="#ffffff">
<?php
if ($_GET["page"]==view_ban) {
if ($rowus[chat_mod]==0) {print"<table width="100%" border="0" cellspacing="0" cellpadding="10" style="BORDER: #ff0000 1px solid"><td width="32"><img src="img/error.gif" width="32" height="32" border="0"></td><td><b><font color="#ff0000">Ошибка! Недостаточно прав.</font></b></td></table>"; exit;}
print"<center><a href=chat1>[Вернуться в ЧАТ]</a></center><br>";
if ($_GET["p"]==del) {
$name=intval($_GET["name"]);
$delete="DELETE FROM tb_chat2 WHERE name='$name'";
mysql_query($delete);
}
print"<table border="1" cellspacing="0" cellpadding="0" width="100%">
<tr bgcolor="#cccccc">
<th>Пользователь (ID)</th>
<th>Разблокировать</th>
</tr>";
$viewto=mysql_query("SELECT * FROM tb_chat2 ORDER BY name DESC");
while ($rowto=mysql_fetch_array($viewto)) {
print"<tr>
<td align="center"><a href="index?id=$rowto[name]" target="_blank">$rowto[fi] ID#$rowto[name]</a></td>
<td align="center">
<a href="chat1?page=view_ban&p=del&name=$rowto[name]">[Разблокировать]</a>
</td>
</tr>";
}
print"</table>";
exit;}
if ($_GET["page"]==add_ban) {
if ($rowus[chat_mod]==0) {print"<table width="100%" border="0" cellspacing="0" cellpadding="10" style="BORDER: #ff0000 1px solid"><td width="32"><img src="img/error.gif" width="32" height="32" border="0"></td><td><b><font color="#ff0000">Ошибка! Недостаточно прав.</font></b></td></table>"; exit;}
$fi=htmlspecialchars($_GET["fi"]);
$name=intval($_GET["name"]);
$count_1m=mysql_query("SELECT COUNT(*) FROM tb_users WHERE id='$name'");
$row_1m=mysql_fetch_row($count_1m);
$count_2m=mysql_query("SELECT COUNT(*) FROM tb_chat2 WHERE name='$name'");
$row_2m=mysql_fetch_row($count_2m);
if ($row_1m[0]>0 and $row_2m[0]==0) {
$add="INSERT INTO tb_chat2 (name, fi) VALUES('$name','$fi')";
mysql_query($add);
}
print"<table width="100%" border="0" cellspacing="0" cellpadding="10" style="BORDER: #00cc00 1px solid"><td width="32"><img src="img/ok.gif" width="32" height="32" border="0"></td><td><b><font color="#00cc00">Пользователь успешно заблокирован!</font></b></td></table><br><br><i>Вы будите перенаправлены на страницу ЧАТа через 5 сек...</i>";
?>
<script language="JavaScript" type="text/javascript">
function Go(){
location="chat1";
}
setTimeout( 'Go()', 5000 );
</script>
<?php
exit;}
if ($_GET["page"]==rep) {
if ($rowus[chat_mod]==0) {print"<table width="100%" border="0" cellspacing="0" cellpadding="10" style="BORDER: #ff0000 1px solid"><td width="32"><img src="img/error.gif" width="32" height="32" border="0"></td><td><b><font color="#ff0000">Ошибка! Недостаточно прав.</font></b></td></table>"; exit;}
$id=intval($_GET["id"]);
$update="UPDATE tb_chat SET flag=0 WHERE id='$id'";
mysql_query($update);
}
if ($_GET["page"]==del) {
if ($rowus[chat_mod]==0) {print"<table width="100%" border="0" cellspacing="0" cellpadding="10" style="BORDER: #ff0000 1px solid"><td width="32"><img src="img/error.gif" width="32" height="32" border="0"></td><td><b><font color="#ff0000">Ошибка! Недостаточно прав.</font></b></td></table>"; exit;}
$id=intval($_GET["id"]);
$update="UPDATE tb_chat SET flag=1 WHERE id='$id'";
mysql_query($update);
}
if ($_GET["page"]==whois) {
if ($rowus[chat_mod]==0) {print"<table width="100%" border="0" cellspacing="0" cellpadding="10" style="BORDER: #ff0000 1px solid"><td width="32"><img src="img/error.gif" width="32" height="32" border="0"></td><td><b><font color="#ff0000">Ошибка! Недостаточно прав.</font></b></td></table>"; exit;}
$name=intval($_GET["name"]);
print"<center><a href=chat1>[Вернуться в ЧАТ]</a><br><b>Сообщения пользователя ID#$name</b></center><br>";
$sql="SELECT * FROM tb_chat WHERE user_id='$name' ORDER BY id DESC";
$result=mysql_query($sql);
while($stat=mysql_fetch_array($result)){
$stat[text]=str_replace(":smile:","<img src=img/smile/smile.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":D:","<img src=img/smile/biggrin.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":razz:","<img src=img/smile/razz.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":cool:","<img src=img/smile/cool.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":hm:","<img src=img/smile/hm.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":wink:","<img src=img/smile/wink.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":mad:","<img src=img/smile/mad.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":sad:","<img src=img/smile/sad.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":cry:","<img src=img/smile/cry.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":confused:","<img src=img/smile/confused.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":crazy:","<img src=img/smile/crazy.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":unsure:","<img src=img/smile/unsure.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":sound:","<img src=img/smile/sound.gif border=0 width=35 height=20>", $stat[text]);
$stat[text]=str_replace(":bad:","<img src=img/smile/bad.gif border=0 width=21 height=21>", $stat[text]);
$stat[text]=str_replace(":sm:","<img src=img/smile/sm.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":flower:","<img src=img/smile/flower.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":kiss:","<img src=img/smile/kiss.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace("**admin","<img src=img/smile/admin.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*flood","<img src=img/smile/flood.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*who","<img src=img/smile/who.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*huy","<img src=img/smile/huy.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*mlya","<img src=img/smile/mlya.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*tiho","<img src=img/smile/tiho.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*danuvas","<img src=img/smile/danuvas.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("#c#","<center><h3><font color=#ff0000>", $stat[text]);
$stat[text]=str_replace("#/c#","</font></h3></center>", $stat[text]);
print"
<table width="100%" border="0">
<td width="30" valign="top">";
if ($stat[img]!="") {
$img_avt_30="<img src="img_foto_30?$stat[user_id].$stat[img]" width="30" border="0">";
} else {
$img_avt_30="<img src="img/avt_30.gif" width="30" border="0">";
}
$on_date=date("d.m.Y");
$on_date2=substr($stat[date],0,10);
$on_date3=substr($stat[date],13,21);
if ($on_date==$on_date2) {$it_date_on="Сегодня $on_date3";} else {$it_date_on="$stat[date]";}
print"$img_avt_30</td>
<td>
<b><font color="$color"><a href="javascript: msgto('$stat[login], ');" class=msg1>$stat[login]</a></font></b>
<br>
$stat[text]<br>
<small><font color="#999999">$it_date_on</font></small><br>
<br>
</td>
</table>
<img src="img/hr_blue.gif" width="100%" height="2" border="0"><br><br>
";
}
exit;}
if ($rowus[chat_mod]==1) {print"<b>Ваш статус:</b> <font color="#00cc00">модератор</font><br><a href="chat1?page=view_ban">[Список заблокированных]</a><br><br>";}
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script>
function show()
{
$.ajax({
url: "up_chat.php",
cache: false,
success: function(html){
$("#content").html(html);
}
});
}
$(document).ready(function(){
show();
setInterval('show()',10000);
});
</script>
<div id="content">
<?
if ($rowus[id]!=1) {$itflag="WHERE flag=0";} else {$itflag="";}
$sql="SELECT * FROM tb_chat $itflag ORDER BY id DESC LIMIT 30";
$result=mysql_query($sql);
while($stat=mysql_fetch_array($result)){
if ($stat[name]==Система) {$color="#ff9900";} else {$color="#000000";}
$stat[text]=str_replace(":smile:","<img src=img/smile/smile.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":D:","<img src=img/smile/biggrin.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":razz:","<img src=img/smile/razz.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":cool:","<img src=img/smile/cool.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":hm:","<img src=img/smile/hm.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":wink:","<img src=img/smile/wink.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":mad:","<img src=img/smile/mad.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":sad:","<img src=img/smile/sad.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":cry:","<img src=img/smile/cry.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":confused:","<img src=img/smile/confused.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":crazy:","<img src=img/smile/crazy.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":unsure:","<img src=img/smile/unsure.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":sound:","<img src=img/smile/sound.gif border=0 width=35 height=20>", $stat[text]);
$stat[text]=str_replace(":bad:","<img src=img/smile/bad.gif border=0 width=21 height=21>", $stat[text]);
$stat[text]=str_replace(":sm:","<img src=img/smile/sm.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":flower:","<img src=img/smile/flower.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace(":kiss:","<img src=img/smile/kiss.gif border=0 width=20 height=20>", $stat[text]);
$stat[text]=str_replace("*1admin","<img src=img/smile/admin.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*1flood","<img src=img/smile/flood.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*1who","<img src=img/smile/who.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*1huy","<img src=img/smile/huy.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*1mlya","<img src=img/smile/mlya.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*1tiho","<img src=img/smile/tiho.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("*1danuvas","<img src=img/smile/danuvas.gif border=0 width=43 height=50>", $stat[text]);
$stat[text]=str_replace("1c1","<center><h3><font color=#ff0000>", $stat[text]);
$stat[text]=str_replace("1/c1","</font></h3></center>", $stat[text]);
if ($rowus[chat_mod]==1) {$mod_ban="<a href="chat1?page=add_ban&name=$stat[user_id]&fi=$stat[fi]" class="mod">[Заблокировать]</a>";} else {$mod_ban="";}
if ($rowus[chat_mod]==1 and $stat[flag]==0) {$mod_del="<a href="chat1?page=del&id=$stat[id]" class="mod">[Удалить сообщение]</a>";} else {$mod_del="";}
if ($rowus[id]==1 and $stat[flag]==1) {$rep="<a href="chat1?page=rep&id=$stat[id]">[Восстановить сообщение]</a>";} else {$rep="";}
if ($rowus[id]==1) {$whois="<a href="chat1?page=whois&name=$stat[user_id]" class="mod">[?]</a>";} else {$whois="";}
print"
<table width="100%" border="0">
<td width="30" valign="top">";
if ($stat[img]!="") {
$img_avt_30="<img src="img_foto_30?$stat[user_id].$stat[img]" width="30" border="0">";
} else {
$img_avt_30="<img src="img/avt_30.gif" width="30" border="0">";
}
$on_date=date("d.m.Y");
$on_date2=substr($stat[date],0,10);
$on_date3=substr($stat[date],13,21);
if ($on_date==$on_date2) {$it_date_on="Сегодня $on_date3";} else {$it_date_on="$stat[date]";}
print"$img_avt_30</td>
<td>
<b><font color="$color"><a href="javascript: msgto('$stat[login], ');" class=msg1>$stat[login]</a></font></b> $whois
<br>
$stat[text]<br>
<small><font color="#999999">$it_date_on</font></small><br>
$mod_del $rep $mod_ban
<br>
</td>
</table>
<img src="img/hr_blue.gif" width="100%" height="2" border="0"><br><br>
";
}
?>
</div>