/
departman_sil.php
33 lines (31 loc) · 1.09 KB
/
departman_sil.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
<?php
session_start();
header("Content-Type: text/html; charset=utf-8");
DEFINE("_ADMIN_GIRDI","1");
include_once "config.php";
include_once $cfg["SiteRoot"]."db_connection.php";
include_once $cfg["SiteRoot"]."functions.php";
if(canUserAccessAdminArea()) {
$departman_id=$_GET['departman_id'];
$sql="select * from departman where departman_id='$departman_id'";
$departmanler = $db->get_row($sql,ARRAY_A);
deleteFile($departmanler["resim_kucuk"],'upload/departments');
deleteFile($departmanler["resim_buyuk"],'upload/departments');
$sql="select image,thumb from resim where tablo='departman' and tablo_id='$departman_id'";
$galeriler = $db->get_results($sql,ARRAY_A);
$galeri_x=0;
if($db->num_rows > $galeri_x)
{
foreach ($galeriler as $galeri)
{
deleteFile($galeri["image"],'upload');
deleteFile($galeri["thumb"],'upload');
$where = [ "tablo_id" => $departman_id ];
deleteTableData("resim",$where);
$galeri_x++;
}
}
$where = [ "departman_id" => $departman_id ];
deleteTableData("departman",$where);
header("location:admin.php?cmd=departman_listesi&result=guncellendi");}
?>