-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetTargetUrl.php
More file actions
executable file
·51 lines (40 loc) · 1.16 KB
/
GetTargetUrl.php
File metadata and controls
executable file
·51 lines (40 loc) · 1.16 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
// A function that returns the TargetUrl given only a SubjectId ...
// ... and an active SQL connection;
function GetTargetUrl($Conn, $SubjectId)
{
// Get the State
$Sql = "SELECT * FROM Register WHERE SubjectId = '$SubjectId'";
$QueryRes = mysqli_query($Conn, $Sql);
if ($QueryRes === false) {
die("Sql failed to execute successfully!");
} else {
while ($Row = mysqli_fetch_assoc($QueryRes)) {
$State = $Row["State"];
}
}
switch ($State) {
case -2:
// Clicked away for too long
return "./Coventry.html?SubjectId=$SubjectId&State=-2#";
case -1:
// Clicked away for too often
return "./Coventry.html?SubjectId=$SubjectId&State=-1#";
case 0:
return "./Consent.html?SubjectId=$SubjectId#";
case 1:
return "./Register.html?SubjectId=$SubjectId#";
case 2:
return "./Instruct.html?SubjectId=$SubjectId&TaskId=TItrain#";
case 3:
return "./TItrain.html?SubjectId=$SubjectId#";
case 4:
return "./Instruct.html?SubjectId=$SubjectId&TaskId=TIprobe#";
case 5:
return "./TIprobe.html?SubjectId=$SubjectId#";
case 6:
return "./Complete.html?SubjectId=$SubjectId#";
default:
die("Invalid state: '$State'");
}
}