-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathta_remove.php
More file actions
executable file
·41 lines (29 loc) · 1.18 KB
/
ta_remove.php
File metadata and controls
executable file
·41 lines (29 loc) · 1.18 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
<?php
$ta_comp_id = $_SERVER['PHP_AUTH_USER'];
//$ta_comp_id = 'hwc2d';
$user_comp_id = strip_tags($_GET['id']);
require_once('dbconnect.php');
$db = DbUtil::loginConnection();
$stmt = $db -> stmt_init();
$reason = 'ta_removed';
//get the user's info
if($stmt -> prepare('SELECT location, help, enter_ts FROM active_queue WHERE comp_id = ?') or die(mysqli_error($db))) {
$stmt -> bind_param("s", $user_comp_id);
$stmt -> execute();
$stmt -> bind_result($location, $help, $enter_ts);
$stmt -> fetch();
}
if($stmt -> prepare('DELETE FROM active_queue WHERE comp_id = ?') or die (mysqli_error($db))) {
$stmt -> bind_param("s", $user_comp_id);
$stmt -> execute();
$db -> commit();
}
if($stmt -> prepare("INSERT INTO ta_logs (`student_comp_id`, `ta_comp_id`, `help`, `enter_ts`, `reason`) VALUES (?, ?, ?, ?, ?)") or die(mysqli_error($db))) {
$stmt -> bind_param("sssss", $user_comp_id, $ta_comp_id, $help, $enter_ts, $reason);
$stmt -> execute();
}
$stmt -> close();
$db -> close();
echo '<button id="close_alert" class="close">×</button>';
echo 'Successfully removed <strong>' . $user_comp_id . '</strong> from queue.';
?>