-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgame_options.php
More file actions
34 lines (30 loc) · 910 Bytes
/
Copy pathgame_options.php
File metadata and controls
34 lines (30 loc) · 910 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
<?php
namespace gameme\PHPGamification;
define('AT_INCLUDE_PATH', '../../include/');
require (AT_INCLUDE_PATH.'vitals.inc.php');
global $_base_href;
array_pop($_POST);
$sql = "DELETE from %sgm_options WHERE course_id=%d";
queryDB($sql, array(TABLE_PREFIX, $_SESSION['course_id']));
foreach($_POST as $option=>$value){
if($value == 'on'){
$value = 1;
} else if($value == 'off'){
$value = 0;
}
$sql = "INSERT into %sgm_options(`id`,`course_id`, `gm_option`, `value`) VALUES ('',%d, '%s',%d)";
if(queryDB($sql, array(TABLE_PREFIX,$_SESSION['course_id'], $option, $value))){
// do nothing
} else {
// en error occured
$has_error = 1;
}
}
if(!isset($has_error)){
$msg->addFeedback('GM_UPDATED_OPTIONS');
}else{
$msg->addError('GM_UPDATED_OPTIONS_FAILED');
}
header('Location: '.$_base_href.'mods/gameme/index_instructor.php');
exit;
?>