-
Notifications
You must be signed in to change notification settings - Fork 1
/
deleteCat.php
45 lines (40 loc) · 1.03 KB
/
deleteCat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
// Verifica se o login foi criado
session_start();
if(!isset($_SESSION["email"])==true){
header("location: login.php");
}
// Arquivo de Configuracao com o Banco de Dados
include "assets/src/cfg.php";
$categoriaID = $_GET["categoriaID"];
$delCat = "delete from categorias where categoriaID = ".$categoriaID;
if(mysqli_query($con,$delCat)){
$msg = "Deletado com sucesso!";
$type = "success";
}else{
$msg = "Erro ao deletar!";
$type = "error";
}
echo "
<html>
<head>
<script src='https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert-dev.js'></script>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.css'>
</head>
<body>
<script>
swal({
position: 'top',
type: '".$type."',
title: '".$msg."',
showConfirmButton: false,
timer: 2000
},
function(){
window.location.href = 'categorias.php';
})
</script>
</body>
</html>
";
?>