-
Notifications
You must be signed in to change notification settings - Fork 6
/
process-photos.php
43 lines (34 loc) · 1.08 KB
/
process-photos.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
<?php
include "includes/_process_include.php";
// structure JSON response
$response = array();
$response['success'] = false;
$response['messages'] = array();
if (!array_key_exists("action", $_POST)) {
$response["messages"][] = 'Invalid action';
echo json_encode($response);
exit();
}
$photosOBJ = new Photos();
if ( $_SERVER["REQUEST_METHOD"] == "POST" ) {
$action = $_POST['action'];
switch($action) {
case 'deletePhoto':
if($_SESSION['type'] == "admin") {
$galleryName = htmlspecialchars(trim($_POST['galleryName']));
$photoName = htmlspecialchars(trim($_POST['photoName']));
$result = $photosOBJ->deleteGalleryPhotos($galleryName,$photoName);
if($result == true){
$response['success'] = true;
}
}
else{
$response['success'] = false;
}
echo json_encode($response);
break; //END 'saveCart'
default:
break; // END 'default'
} // End Switch
}
?>