Файл: chat/index.php
Строк: 152
<?php
define('PROTECTOR', 1);
/*
* PHP+jQuery+MySQL Chat, version 0.2
* index.php
* http://i-wanna-think.ru/
*
* Copyright 2013, Ivan Tkachenko
* Date: 2013-04-29
*/
require_once('functions/fns.php');
///////////////////////
$path='../'; //
//////////////////////
include($path.'files/func.php');
include($path.'files/core.php');
include($path.'files/head.php');
include($path.'files/zag.php');
// при входе в чат чистим таблу с плюсиком
mysql_query("DELETE FROM chat_otv WHERE `usr`='$log'");
//-----------УДАЛЯЕМ ПОСТЫ--------
if ($_GET[mod]=='del_post' and $udata[prava] >= 2 and !empty($_GET[p])){
$asd = mysql_query("SELECT * FROM komentarai WHERE id='$_GET[p]' LIMIT 1");
$avto=mysql_num_rows($asd);
if($avto==0){
echo'<p>Нет такого поста!</p><br/>';
}else{
mysql_query("DELETE FROM `komentarai` WHERE id='$_GET[p]' LIMIT 1");
echo'<p>Пост успешно удалён!</p><br/>';
}
}
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.jplayer.min.js"></script>
<script type="text/javascript" src="js/chat_scripts.js"></script>
<style>
#chat_body*
{
margin:8px auto 3px;
float:left;
word-wrap: break-word;
}
#chat_text_field
{
overflow:auto;
*border:1px solid #999;
*-webkit-border-radius: 5px 5px 5px 5px;
*-moz-border-radius: 5px 5px 5px 5px;
*border-radius: 5px 5px 5px 5px;
*padding:3px;
*background-color:#CCC;
}
#chat_text_input
{
float:left;
margin:3px 0;
font:13px Verdana, Geneva, sans-serif;
border:1px solid #999;
-webkit-border-radius: 5px 5px 5px 5px;
-moz-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
#chat_button
{
float:left;
margin:2px 5px 2px 15px;
}
#logout_button
{
float:left;
margin:2px 5px;
}
.chat_mess_time {font:10px Verdana, Geneva, sans-serif !important; margin:1px 3px; float:right;}
.chat_nickname {font-weight:bold;}
.chat_post_my {font:11px Verdana, Geneva, sans-serif !important; margin:1px 3px; color:#161;}
.chat_post_other {font:11px Verdana, Geneva, sans-serif !important; margin:1px 3px; color:#039;}
.mess_text_area
{
font:11px Verdana, Geneva, sans-serif;
color:#333;
padding:0 3px 10px 3px;
}
.parsed_url** { color:#06C !important; text-decoration:none;}
.parsed_url:hover** { color:#06C; text-decoration: underline;}
</style>
<body>
<div id="jpId"></div>
<div id="chat_body">
<div id="chat_text_field" style="height:300px;">
<?php echo $message_code; ?>
</div>
<input id="last_act" name="last_act" type="hidden" value="<?php echo $last_act; ?>" /><!--Номер последнего сообщения-->
<input id="block" name="block" type="hidden" value="no" /><!--Блокировка повторного вызова функции-->
<hr/>
<?
if ($udata[lvl]<11){
echo "<p><font color=red>* * В чате можно писать с 11 уровня! </font></p><hr/>";
}else{
if (isset($_GET[otv])){$otv = safe_var($_GET[otv]);$otv = "$otv, ";}
?>
<form method='post' name='message' action='?'>
<!--
<script language="JavaScript" type="text/javascript">
function tag(text1) {
if ((document.selection)) {
document.message.msg.focus();
document.message.document.selection.createRange().text = document.message.document.selection.createRange().text+text1;
} else if(document.forms['message'].elements['chat_text_input'].selectionStart!=undefined) {
var element = document.forms['message'].elements['chat_text_input'];
var str = element.value;
var start = element.selectionStart;
var length = element.selectionEnd - element.selectionStart;
element.value = str.substr(0, start) + text1 + str.substr(start, length) + str.substr(start + length);
document.forms['message'].elements['chat_text_input'].focus();
} else document.message.msg.value += text1;
document.forms['message'].elements['chat_text_input'].focus();
}</script>
-->
<script language="javascript" type="text/javascript">
<!--
var ie=document.all?1:0;
var ns=document.getElementById&&!document.all?1:0;
function tag(text1)
{
if(ie)
{
document.all.message.focus();
document.all.message.value+=text1;
}
else if(ns)
{
document.forms['message'].elements['chat_text_input'].focus();
document.forms['message'].elements['chat_text_input'].value+=text1;
}
else
alert("Ваш браузер не поддерживается!");
}
// -->
</script>
<textarea id="chat_text_input" name="chat_text_input"><?echo "$otv";?></textarea>
<input id="chat_button" name="chat_button" type="button" style="" value="Ответить"/>
</form>
<?
}
?>
</div>
<div style="clear:both;"></div>
</body>
</html>
<?php
include($path.'files/down.php');
?>