Размер файла: 4.22Kb
<?php
####################
# Автор: [Svig] #
# ICQ: 563000172 #
####################
$add = "add";
if($_GET['mode']==$add)
{
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");
}
}
$del = "del";
if($_GET['mode']==$del)
{
include ("../conf.php");
include ("../lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
if($user == $adname){
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo <<<sss
<form name="" action="news.php?mode=drop&user=$user&pass=$pass" method="post">
sss;
$result = mysql_query("SELECT text,id FROM news");
$myrow = mysql_fetch_array($result);
do
{
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo " <input name='id' type='radio' value='".$myrow['id']." '>";
echo " ".$myrow['text']." <br /></div>";
}
while ($myrow = mysql_fetch_array($result));
echo <<< sss
<div class='nav'>
<input type="submit" value="Удалить новость"></form></div>
<div class='nav'>
• <a href=../menu.php?user=$user&pass=$pass>В меню</a>
</div>
sss;
include ("../foot.php");
}
}
else
{
include ("../head.php");
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo <<<sss
<a href="../index.php">На главную</a>
sss;
}
}
$drop = "drop";
if($_GET['mode']==$drop)
{
include ("../conf.php");
include ("../lock.php");
if ($user == $myrow["user"] && $pass == $myrow["pass"])
{
if($user == $adname){
if (isset($_POST['id'])) {$id = $_POST['id'];}
if (isset($id))
{
$result = mysql_query("DELETE FROM news WHERE id='".$id."'");
if ($result == 'true') {
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo "Новость Удалена!</div>";
echo <<< sss
<div class='nav'>
• <a href=../menu.php?user=$user&pass=$pass>В меню</a>
</div>
sss;
include ("../foot.php");
}
else {
include ("../head.php");
echo "<link rel='stylesheet' type='text/css' href='../style.css'/>";
echo "<div class='nav'>";
echo "Новость не Удалена!";
echo <<< sss
<div class='nav'>
• <a href=../menu.php?user=$user&pass=$pass>В меню</a>
</div>
sss;
include ("../foot.php");
}
}
else
{
echo "<p>Ошибка!!!</p>";
}
}
}
else
{
include ("../head.php");
echo "Ошибка! <br />Неверный <b>Ник</b> или <b>Пароль</b>!<br />";
echo <<<sss
<a href="../index.php">На главную</a>
sss;
include ("../foot.php");
}
}
?>