forked from whynotyet/QualTurk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput.php
More file actions
39 lines (33 loc) · 983 Bytes
/
output.php
File metadata and controls
39 lines (33 loc) · 983 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
35
36
37
38
39
<?php
session_start();
if(!isset($_SESSION['username']) or !isset($_SESSION['user_id']) or !isset($_GET['survey_id'])){
header('Location: http://www.qualturk.com/?logout=1');
die("ERROR");
}
include 'functions.php';
connectDB();
$query=sprintf("SELECT hit_id,`status`,time_created,date_returned,worker_id,guid FROM `hits` WHERE survey_id='%s' ORDER BY `status`,worker_id",
mysql_real_escape_string($_GET['survey_id']));
$result = mysql_query($query);
$result || die(mysql_error());
if(!mysql_num_rows($result)){
die("No records available for this Survey ID.");
}
echo '"hit_id","status","time_started","time_ended","worker_id","GUID"'."\n";
while($row = mysql_fetch_row($result)) {
$comma = false;
foreach ($row as $item) {
#make it comma separated
if ($comma) {
echo ',';
} else {
$comma = true;
}
#quiote the quiotes
$quoted = str_replace("\"", "\"\"", $item);
#quiote the string
echo "\"$quoted\"";
}
echo "\n";
}
?>