<?
@session_start();
include('../connect/connect.php');
include('../lib/lib.php');
if($_REQUEST['komu'])
$komu=intval($_REQUEST['komu']);
$admin=intval($_REQUEST['admin']);
if($admin==1)
{
$ot_kogo=0;
$autor='Администратор';
}
else
{
$ot_kogo=$_SESSION['ID_P'][1];
$autor=$_SESSION['ID_P'][3];
}
if($_POST['submit'])
{
$r=mysql_query("SELECT id_akk, contakt FROM akk WHERE id_akk='".$komu."'");
$rr=mysql_fetch_array($r);
$autor_komu=$rr['contakt'];
$me=_pre2($_POST['mess']);
$mess=$me[1];
if(!$mess) $err .= "Введите текст сообщения<br>";
if(!$err)
{
$query="INSERT INTO mess (
ot_kogo,
autor,
autor_komu,
komu,
mess,
data
)
VALUES
(
'".$ot_kogo."',
'".$autor."',
'".$autor_komu."',
'".$komu."',
'".$mess."',
NOW()
)
";
if(mysql_query($query))
{
$otp = '<font color=green >Сообщение отправлено</font>';
}
else $err='Не удалось отправить сообщение';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="robots" content="nofollow" />
<link rel="stylesheet" type="text/css" href="../style/style.css" />
<script type="text/javascript" charset="utf-8" src="../js/jquery-1.4.4.min.js"></script>
</head>
<BODY>
<table width=100%>
<tr height=64>
<td width=64>
<img border=0 src="../icon/8.gif">
<td align=center><h3>Приватное сообщение</h3>
<tr>
<td colspan=2>
<?
if($otp) echo '<p>'.$otp.'</p>';
else
{
if($err) echo '<p><font color=red>'.$err.'</font></p>';
?>
<form method="post" action="" >
<textarea rows="10" cols="55" name="mess" ><?=stripslashes(htmlspecialchars_decode($mess))?></textarea>
<input type="hidden" name="komu" value="<?=$komu?>">
<input type="hidden" name="admin" value="<?=$admin?>">
<br>
<input type="submit" name="submit" class="submit" value="Отправить">
</form>
<?
}
?>
</table>
</body>
</html>