-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent_change.php
More file actions
29 lines (24 loc) · 876 Bytes
/
event_change.php
File metadata and controls
29 lines (24 loc) · 876 Bytes
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
<?php
require_once('check_connected.php');
require_once('db_constants.php');
ini_set('display_errors',1);
if (isset($_GET['id'])) {
try{
$bdd = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8', DB_USERNAME, DB_PASSWORD);
$request = $bdd->prepare("UPDATE " . TABLE_EVENTS . " SET state = :state, date = CURRENT_TIMESTAMP WHERE id = :id");
$request->bindParam(":id", $_GET['id']);
$state ="published";
if ($_GET['state'] == "0") {
$state ="deleted";
}
$request->bindParam(":state", $state);
$request->execute();
require 'lib/Logger.class.php';
$logger = new Logger('./logs');
$text = (($_GET['state'] == "0") ? 'Recovering' : 'Deleting');
$logger->log('', 'events', $text . ' event ID ' . $_GET['id'] . ' by user ' . $_SESSION['name'], Logger::GRAN_VOID);
}catch (Exception $e) {
echo 'Erreur : ' . $e->getMessage();
}
}
?>