Просмотр файла admin/rekl.php

Размер файла: 1.22Kb
<?php
include '../inc/db.php';
include '../inc/1.php';
if (!$user){header("Location: /aut.php");
exit;}
if ($user['admin']==1){
if (!$_POST['time'] || !$_POST['name'] || !$_POST['href']){
echo "<div class='p0'><form action='?' method='POST'>Время*:<br><input type='text' name='time'><br>Ссылка:<br><input name='href' type='text'><br>Картинка**:<br><input name='img' type='text'><br>Имя ссылки:<br><input name='name' type='text'><br>Место***:<br><input name='where' type='text'><br><input type='submit' name='OK' value='Добавить'></form>*В днях.<br>**Не обязательно.<br>***1 - главная (верх), 2 - остальные (верх), 3 - низ, все</div>";
}
else
{
$name=mysql_escape_string($_POST['name']);
$href=mysql_escape_string($_POST['href']);
$img=mysql_escape_string($_POST['img']);
$where=intval($_POST['where']);
$o=time();
$time=($o+(intval($_POST['time'])*3600*24));
mysql_query("INSERT INTO `rekl` (`href`, `img`, `time`, `where`, `name`) values ('$href', '$img', '$time', '$where', '$name')");
echo "<div class='msg'>Реклама добавлена</div>";
}
}
else{
header("Location: /index.php");
exit;}
include '../inc/foot.php';
?>