-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgame_update_base.php
More file actions
40 lines (31 loc) · 895 Bytes
/
game_update_base.php
File metadata and controls
40 lines (31 loc) · 895 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
30
31
32
33
34
35
36
37
38
39
40
<?php
// Update the verify status of a game
include_once('directory.php');
include_once('game_detail_edit.php');
include_once('new_game_object.php');
include_once('game_exists.php');
include_once('convert_bgg_to_id.php');
function get_id_from_URL($url) {
$parse = parse_url($url);
$parts = explode('/', $parse['path']);
return $parts[2];
}
function update_base($id, $base){
$base_id = get_id_from_URL($base);
echo $base_id;
if(game_exists($base_id) || $base_id == NULL) {
try {
$db = new PDO('sqlite:' . dir_path() . '/data/games_db.sqlite');
$non_bgg_id = convert_bgg_to_id($base_id);
$db->exec("UPDATE Game SET BaseGame = '" . $non_bgg_id . "' WHERE Id = '" . $id . "';");
return game_detail(new_game_object($id));
}
catch(PDOException $e) {
print 'Exception : '. $e->getMessage();
}
}
else {
return false;
}
}
?>