View file admin/add_news.php

File size: 1.57Kb
<?php
include ("../conf.php");
include ("../lock.php");

if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
if($user == $adname){

if (isset($_POST['text']))         {$text = $_POST['text'];     if ($text == ''){unset($text);} }
if (isset($_POST['date']))        {$date = $_POST['date'];   if ($date == '') {unset($date);} }


if (isset($text) && isset($date))
{
$result = mysql_query("INSERT INTO news (text,date) VALUES ('$text','$date')");

if ($result == 'true')
{
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo "Новость успешно добавлена!<br />";
echo "• <a href=../menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("../foot.php");
}
else
{
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo "Новость не добавлена!<br />";
echo "• <a href=../menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
 include ("../foot.php");
}
}
else
{
include ("../head.php");
 echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo "Вы ввели не всю информацию.<br />";
echo "• <a href=../menu.php?user=$user&pass=$pass>В меню</a>";
echo "</div>";
include ("../foot.php");
}
exit();
}
}
else
{
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo <<<sss
<a href="../index.php">На главную</a>
sss;
include ("../foot.php");
}
?>