/
delete.php
82 lines (78 loc) · 1.71 KB
/
delete.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
require_once 'support/config.php';
if(!isLoggedIn()){
toLogin();
die();
}
if(!AllowUser(array(1,2))){
redirect("index.php");
}
if(empty($_GET['id']) || empty($_GET['t'])){
redirect('index.php');
die;
}
else
{
$table="";
switch ($_GET['t']) {
case 'a':
$table="assets";
$page="assets.php";
$activity_input['admin_id']=$_SESSION[WEBAPP]['user']['id'];
$activity_input['item_id']=$_GET['id'];
$con->myQuery("INSERT INTO activities(admin_id,action,action_date,category_type_id,item_id) VALUES(:admin_id,'Deleted Asset',NOW(),1,:item_id)",$activity_input);
break;
case 'am':
$table="asset_models";
$page="asset_models.php";
break;
case 'c':
$table="consumables";
$page="consumables.php";
break;
case 'u':
$table="users";
$page="user.php";
break;
case 'dep':
$table="departments";
$page="departments.php";
break;
case 'mt':
$table="asset_maintenance_types";
$page="maintenance_types.php";
break;
case 'depr':
$table="depreciations";
$page="depreciations.php";
break;
case 'asl':
$table="asset_status_labels";
$page="asset_status_labels.php";
break;
case 'l':
$table="locations";
$page="locations.php";
break;
case 'man':
$table="manufacturers";
$page="manufacturers.php";
break;
case 'fu':
$table="files";
$page="assets.php";
if(!empty($_GET['a'])){
#asset_id
$page="view_asset.php?id={$_GET['a']}";
}
break;
default:
redirect("index.php");
break;
}
$con->myQuery("UPDATE {$table} SET is_deleted=1 WHERE id=?",array($_GET['id']));
Alert("Delete Successful.","success");
redirect($page);
die();
}
?>