File size: 1.88Kb
<?
/*
Автор: SaDiEv
Сайт: comwap.ru
Пример работы: comwap.ru/top
Страница: admin/del_category.php
Назначение: удаление категории
*/
Error_Reporting(E_ALL & ~E_NOTICE); Error_Reporting (ERROR | WARNING);
extract($HTTP_GET_VARS); extract($HTTP_POST_VARS); extract($HTTP_COOKIE_VARS); extract($HTTP_SERVER_VARS); extract($HTTP_SESSION_VARS);
//сессии
session_name("SESID"); session_start();
// подключаем настройки
include "../config/sis.php";
include "../config/other.php";
$TITLES = "удаление категории";
$connect=mysql_connect ($DB_HOST, $DB_USER, $DB_PASS);
mysql_select_db($DB_NAME);
if($brodilka==wap){include "../theme/".$wap_theme."/head.php";}
else {include "../theme/".$web_theme."/head.php";}
echo"<div class='content'>";
@$cat=$_GET['cat'];
@$id=$_GET['id'];
if($_SESSION['pass']==$password)
{
if($cat==""){
echo "Категории<br>";
$query = mysql_query( "SELECT * FROM `category`" );
while ( $result = mysql_fetch_assoc( $query ) ) {
$count = mysql_result( mysql_query( "SELECT COUNT(*) FROM `users` WHERE `category` = {$result['nomer']} && counthost >= 1" ), 0 );
echo '<img src="../images/category.png" alt="." />'; printf( '<a href="del_category.php?cat=del&id=%d">DEL %s</a> ['.$count.']<br/>', $result['nomer'], $result['name'] );
}}
if($cat=="del"){
$id=@mysql_escape_string($id);
$q_u=mysql_query("select * from category where id='".$id."';");
$data=mysql_fetch_array($q_u);
if(mysql_query("Delete from category where nomer='".$id."'")){echo "удалено!";} else{echo"error!";}
}
}
else
{echo"ошибка<br></div>";}
mysql_close($connect);
include "dat/baner.dat";
print "<div id='foot'><center>$autor<center></div>";
if($brodilka==wap){include "../theme/".$wap_theme."/foot.php";}
else {include "../theme/".$web_theme."/foot.php";}
?>