-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathupdate_article.php
More file actions
41 lines (38 loc) · 1.38 KB
/
update_article.php
File metadata and controls
41 lines (38 loc) · 1.38 KB
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
<?php
session_start();
function giveSucces($msg=''){
$_SESSION['msg'] = '<i class="material-icons">check</i> ' . $msg;
header("Location:articles.php");
}
include 'inc/header.inc.php';
if (empty($_GET['action'])) {
$_SESSION['msg'] = "Es ist ein Fehler aufgetreten. Bitte versuchen sie es erneut!";
header("Location:articles.php");
}
if (empty($_GET['article_id'])) {
$_SESSION['msg'] = "Es ist ein Fehler aufgetreten. Bitte versuchen sie es erneut!";
header("Location:articles.php");
}
$action = $_GET['action'];
$article_id = $_GET['article_id'];
switch ($action) {
case 'update_article':
// TODO: MACHEN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
giveSucces("Der Artikel wurde erfolgreich bearbeitet!");
break;
case 'delete_article':
global $pdo;
$statement = $pdo->prepare( "DELETE FROM `articles` WHERE `id` = $article_id");
$result = $statement->execute();
giveSucces("Der Artikel wurde erfolgreich gelöscht!");
break;
case 'update_quantity':
// TODO: MACHEN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
giveSucces("Die Menge wurde erfolgreich hinzugefügt!");
break;
default:
$_SESSION['msg'] = "Es ist ein Fehler aufgetreten. Bitte versuchen sie es erneut!";
header("Location:articles.php");
break;
}
?>