<?php require_once '../system/config.php'; require_once '../system/database.php'; if (isset($_GET['delete']) && !empty($_GET['delete'])) { $id = DBEscape(strip_tags(trim($_GET['delete']))); $exist = DBRead('categorias', "WHERE id = '{$id}'"); if ($exist) { if (DBRead('posts', "WHERE categoria = '{$id}'")) { DBUpDate('posts', array('status' => 0), "categoria = '{$id}'"); } DBDelete('categorias', "id = '{$id}'"); } header('Location: categorias.php'); } ?> <!DOCTYPE html> <html lang="pt-BR"> <head> <meta charset="UTF-8"> <title>Gerenciar Categorias</title> </head> <body> <h2> Gerenciar Categorias | <a href="index.php" title="Gerenciar Postagens">Gerenciar Postagens</a> | <a href="add-categ.php" title="Adicionar Categoria">Adicionar Categoria</a> </h2>
$id = DBEscape(strip_tags(trim($_GET['id']))); switch ($_GET['action']) { case 1: $post = DBRead('posts', "WHERE id = '{$id}'"); if (DBRead('categorias', "WHERE id = '" . $post[0]['categoria'] . "'")) { DBUpDate('posts', array('status' => 1), "id = '{$id}'"); } else { header('Location: edit-post.php?id=' . $id . '&&changeCateg'); die; } break; case 2: DBUpDate('posts', array('status' => 0), "id = '{$id}'"); break; case 3: DBDelete('posts', "id = '{$id}'"); break; } header('Location: index.php'); } ?> <!DOCTYPE html> <html lang="pt-BR"> <head> <meta charset="UTF-8"> <title>Gerenciar Postagens</title> </head> <body> <h2>