Размер файла: 1.8Kb
<?php
include '../verh.php';
session_name('USERSID');
session_start();
$id=intval($_SESSION['id']);
$pass=$_SESSION['pass'];
if (!mysql_num_rows(mysql_query("SELECT * FROM inet_sites WHERE id='$id' AND pass='$pass'"))) {
header("Location: $workdir/profile/index.php?error=1");
ob_end_clean();
exit;
}
$prof=mysql_fetch_array(mysql_query("SELECT * FROM inet_sites WHERE id='$id'"));
preg_match('|http://(.+)/*|', $prof['url'], $m);
$iname=$m[1];
echo "<form action='feedback.php' method='post'>
<textarea name='mes'></textarea><br/>
<input type='submit' name='send' value='Отправить'/><br/>
</form>";
echo "<div class=\"b\">";
if (@$_POST['send'] and (!empty($_POST['mes']))) {
$mes=$_POST['mes'];
$mes=str_replace("\r\n", "<br/>", $mes);
$mes=str_replace("\n", "<br/>", $mes);
if (!mysql_num_rows(mysql_query("SELECT * FROM inet_feedback WHERE ot='$id' AND mes='$mes' AND sdate > NOW() - INTERVAL 5 MINUTE"))) {
mysql_query("INSERT INTO inet_feedback SET ot='$id', komu=NULL, mes='$mes', sdate=NOW()");
}
header("Location: feedback.php");
}
$p=@intval($_GET['p']);
$res=mysql_query("SELECT *, DATE_FORMAT(sdate, '%d.%m.%y %H:%i') AS sdate FROM inet_feedback WHERE ot='$id' OR komu='$id' ORDER BY sdate DESC LIMIT $p,$limit");
while ($mes=mysql_fetch_array($res)) {
if (empty($mes['ot'])) {
$ot='Admin';
} else {
$ot=$iname;
}
echo "$mes[sdate]<br/><b>$ot</b><br/>$mes[mes]<br/>";
echo "</div><div class=\"b\">";
}
$next = $p+$limit;
$prev = $p-$limit;
if ($p>0) {
echo "<a href=\"feedback.php?p=$prev\">Назад</a>";
}
list($c)=mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM inet_feedback WHERE ot='$id' OR komu='$id'"));
if ($p+$limit<$c) {
echo " <a href=\"feedback.php?p=$next\">Далее</a>";
}
echo "</div><div class=\"b\">
»<a href=\"menu.php\">Меню</a><br/>";
include '../niz.php';
?>