View file Panel/delete_news.php

File size: 1.11Kb
<?PHP
require '../System/core.php';
 $config['title'] = 'Удаление новости';
require '../System/header.php';

if(!isset($user)){header('Location: /');}

if(!isset($_GET['id'])){header('Location: /');}

$id = num($_GET['id']);

if(isset($_POST['delete_news']))
 {
  mysql_query("DELETE FROM `news` WHERE `id` = '$id'"); $sql_count++;
  header('Location: /News');
 }

$query = mysql_query("SELECT * FROM `news` WHERE `id` = '$id'"); $sql_count++;

if(mysql_num_rows($query) !== '0')
 {
  $news = mysql_fetch_array($query);
  
  ?>
     <div class="text">
	  Вы действительно хотите удалить новость <b><?=$news['name']?></b>?<br />
	  <form action="" method="POST">
	   <input type="submit" name="delete_news" value="Удалить">
	  </form>
	 </div>
  <?
 }
else
 {
 
 }

echo '<div class="back"><a href="/Panel/"><img src="/Style/icons/back.png" alt="" /> В панель управления</a></div>';
echo '<div class="back"><a href="/"><img src="/Style/icons/back.png" alt="" /> На главную</a></div>';
require '../System/footer.php';
?>