Просмотр файла us_guest/reply.php

Размер файла: 2.57Kb
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
only_reg();

$set['title']='Ответ на сообщение';
include_once '../sys/inc/thead.php';
title();

if (isset($_GET['ok']))
{
$id_razd=(int)abs((int)$_GET['ok']);

$post = mysql_fetch_array(mysql_query("SELECT * FROM `us_guest` WHERE `id`='".$id_razd."' LIMIT 1"));
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`=$post[id_user] LIMIT 1"));
$g_adm = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`=$post[id_user] LIMIT 1"));
$reply = $_POST['reply'];
$reply=mysql_escape_string($reply);
$arr = array("wapsa.ru"=>"[red]wapmoda.ru[/red]", "Wapsa.ru"=>"[red]wapmoda.ru[/red]","WAPSA.RU"=>"wapmoda.ru");


$msg2="[b]$g_adm[nick][/b] Ответил на ваше сообщение, в гостевой книге [url=http://мой сайт/us_guest/?id=$g_adm[id]]$ank[nick][/url]";
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '$msg2', '$time')");
$nick_s = mysql_fetch_array (mysql_query ("select `nick` from `user` where (`id` = '".$post['id_user']."') limit 1;"));
$nick = $nick_s['nick'];
mysql_query(strtr("INSERT INTO `us_guest` (id_user,id_user_adm, time, msg) values('$user[id]', '$post[id_user_adm]', '$time', '$nick, $reply')",$arr));
header("Location: index.php?id=$post[id_user_adm]");
exit;
}

$id_razd=(int)abs((int)$_GET['id']);

$post = mysql_fetch_array(mysql_query("SELECT * FROM `us_guest` WHERE `id`='".$id_razd."' LIMIT 1"));
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`=$post[id_user] LIMIT 1"));
echo $ank['nick']." написал:<br/>\n";
echo $post['msg']."<br/>\n";
echo '<form method="post" action="reply.php?ok='.$id_razd.'">';
echo 'Ответ:<br/><textarea name="reply"></textarea><br/>';
echo '<input type="submit" value="Ответить"/>';
echo '</form>';
if (!isset($_GET['id']) && !is_numeric($_GET['id'])){header("Location: http://my-spaces.ru/index.php?".SID);exit;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `us_guest` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1",$db), 0)==0){header("Location: http://my-spaces.ru/index.php?".SID);exit;}
echo "<a href='index.php?id=$post[id_user_adm]'>Назад</a><br />\n";


include_once '../sys/inc/tfoot.php';
?>