Просмотр файла adminka/support.php

Размер файла: 1.79Kb
<?php
session_name("SESID");
session_start();
include ('../verh.php');

if($_SESSION['pass']!=$adminpass) {echo "ERROR 404! Not fond.</div></body></html>\n";exit;}
$id=@$_REQUEST['id'];
echo "<form action='support.php' method='post'>
ID:<br/>
<input type='text' name='id' value='$id'/><br/>
Сообщение:<br/>
<textarea name='mes'></textarea><br/>
<input type='submit' name='send' value='Отправить'/><br/><br/>
</form>";

if (@$_POST['send'] and (!empty($id)) and (!empty($_POST['mes']))) {
	$mes=$_POST['mes'];
	$mes=str_replace("\r\n", "<br/>", $mes);
	$mes=str_replace("\n", "<br/>", $mes);
	mysql_query("INSERT INTO inet_feedback SET ot=NULL, komu='$id', mes='$mes', sdate=NOW()");
	header("Location: support.php");
}


$p=@intval($_GET['p']);
$res=mysql_query("SELECT a.*, DATE_FORMAT(a.sdate, '%d.%m.%y %H:%i') AS sdate, b.url
 FROM inet_feedback a, inet_sites b
 WHERE a.ot=b.id OR a.komu=b.id ORDER BY a.sdate DESC LIMIT $p,$limit");

while ($mes=mysql_fetch_array($res)) {
	if (empty($mes['ot'])) {
		preg_match('|http://(.+)/*|', $mes['url'], $m);
		$iname=$m[1];
		echo "$mes[sdate]<br/> <b>Admin</b> &gt; <a href='support.php?id=$mes[komu]'>$iname</a> <a href='view.php?id=$mes[komu]'>[view]</a><br/>";
	} else {
		preg_match('|http://(.+)/*|', $mes['url'], $m);
		$iname=$m[1];
		echo "$mes[sdate]<br/> <a href='support.php?id=$mes[ot]'><b>$iname</b></a> <a href='view.php?id=$mes[ot]'>[view]</a><br/>";
	}
	echo "$mes[mes]<br/><br/>";
}

$next = $p+$limit;
$prev = $p-$limit;
if ($p>0) {
echo "<a href=\"support.php?p=$prev\">Назад</a>";
}
list($c)=mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM inet_feedback"));
if ($p+$limit<$c) {
echo " <a href=\"support.php?p=$next\">Далее</a>";
}


echo "<div class=\"info\"/><a href=\"apanel.php\">Админка</a></div>";
include ('../niz.php');

?>