-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcard_delete.php
More file actions
26 lines (22 loc) · 880 Bytes
/
card_delete.php
File metadata and controls
26 lines (22 loc) · 880 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
<?php
// include_once("login_session.php");
include_once('directory.php');
// Deletes a Card row from the Card DB
// Used on Game editing pages
if(session_status() != PHP_SESSION_NONE && $_SESSION["loggedIn"] && isset($_POST['sleeve_id'])) {
$sleeve_id = $_POST['sleeve_id'];
$card_nb = $_POST['card_nb'];
$game_id = $_POST['game_id'];
card_delete($game_id, $sleeve_id, $card_nb);
}
function card_delete($g, $sleeve_id, $card_nb){
try {
$db = new PDO('sqlite:' . dir_path() . '/data/games_db.sqlite');
$db->exec("DELETE FROM Cards WHERE GameId = '" . $g . "' AND SleeveId = '" . $sleeve_id ."' AND CardNb = '" . $card_nb ."';");
echo "DELETE FROM Cards WHERE GameId = '" . $g . "' AND SleeveId = '" . $sleeve_id ."' AND CardNb = '" . $card_nb;
}
catch(PDOException $e) {
print 'Exception : '. $e->getMessage();
}
}
?>