forked from rbwatson/wlux_test_server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.php
More file actions
84 lines (73 loc) · 2.66 KB
/
Copy pathstart.php
File metadata and controls
84 lines (73 loc) · 2.66 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
// get session ID from query string
// get the request data
if (!empty($HTTP_RAW_POST_DATA)) {
$postData = json_decode($HTTP_RAW_POST_DATA,true);
}
// if the data is not in the raw post data, try the post form
if (empty($postData)) {
$postData = $_POST;
}
// if the data is not in the the post form, try the query string
if (empty($postData)) {
$postData = $_GET;
}
$studyId = 0;
if (!empty($postData['wlux_study'])) {
$studyId = $postData['wlux_study'];
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
h2 { margin-top: 1em; }
div.container { width: 500px; margin: auto; }
</style>
<title>WebLabUX Study Welcome Page</title>
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$j = jQuery.noConflict();
var host = window.location.host;
var LOCAL = (host.indexOf("localhost") != -1) ||
(host.indexOf("127.0.0.1") != -1);
var sessionURL = "http://wlux.uw.edu/rbwatson/session.php";
if (LOCAL) {
sessionURL = "/rbwatson/session.php";
}
function getSession () {
// get session info
$j.ajaxSetup({async: false}); //
// if undefined, use ""
if (<?php echo $studyId ?> > 0) {
var postResult = $j.post (sessionURL, {"start": {"studyId" : <?php echo $studyId ?>}},"json");
postResult.done (function (response) {
if (response.data !== undefined) {
// alert("Going to: " + nextPage);
$j("#sessionField").attr("value", response.data.sessionId.toString());
$j("#continueBtn").attr("disabled",false);
} else {
$j("#textDiv").html("<p>Study <?php echo $studyId ?> could not be found.<br/>Try again with another study ID.</p>");
}
});
} else {
$j("#textDiv").html("<p>No study was specified</p>");
}
}
</script>
</head>
<body onLoad="getSession()">
<div class="container">
<h2>WebLabUX Survey Consent Form</h2>
<div id="textDiv">
<p>Thank you for agreeing to participate in our survey.<br />
Please click on continue to begin the survey</p>
</div>
<form id="continueButton" name="form1" method="POST" action="task-start.php">
<input id="sessionField" type="hidden" name="wlux_session" value="0" />
<input id="continueBtn" type="submit" value="continue" disabled />
</form>
</div> <!-- container -->
</body>
</html>