-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsave.php
More file actions
51 lines (41 loc) · 1.08 KB
/
Copy pathsave.php
File metadata and controls
51 lines (41 loc) · 1.08 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
42
43
44
45
46
47
48
49
50
51
<?php
session_start();
require_once("config/config.inc.php");
require_once("includes/Database.php");
require_once("load.php");
// Authentication
require_once("includes/verify_access.php");
restrict_access($db,array("admin"));
$id = $_POST['id'];
if(isset($_POST['field']))
$field = $_POST['field'];
else
$field = $id;
$value = $_POST['value'];
$table = $_POST['table'];
$row_id = $_POST['row_id'];
$reservation_id = $_POST['reservation_id'];
$out = "";
foreach($_POST as $var => $val)
{
$out .= $var.":".$val."\n";
}
// display the formatted saved value
if(!strcmp($table,'study_rooms') && !strcmp($field,'room_group_id'))
{
$all_room_groups = load_room_groups();
$room_group_options = array();
foreach($all_room_groups as $room_group)
{
$room_group_options[$room_group->id] = $room_group->name;
}
print($room_group_options[$value]);
}
else
print($value);
// complete the update
if(isset($_POST['row_id']))
$db->update($table,$field,$value,"id like '$row_id'");
else if(isset($_POST['reservation_id']))
$db->update($table,$field,$value,"reservation_id like '$reservation_id'");
?>