Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·126 lines (112 loc) · 6.54 KB
/
Copy pathindex.php
File metadata and controls
executable file
·126 lines (112 loc) · 6.54 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require "credentials.inc";
if(!isset($_GET['q'])) {
echo "Please provide a query string via the \"q\" parameter.";
exit;
}
$key = pg_escape_string($_GET['q']);
$dbconn = pg_connect("host=$dbhost port=5432 dbname=$dbname user=$dbuser password=$dbpass");
// GET SURVEY DETAILS
$query = "SELECT * FROM tweets WHERE id = '".$key."'";
$results = pg_query($dbconn, $query) or die(pg_last_error());
$row = pg_fetch_object($results);
// STORE WHEN THE USER FIRST ACCESSED THE SURVEY
if (strlen($row->accessedsurvey) < 1) {
$q = "UPDATE tweets SET accessedsurvey = now() where id = '".$key."'";
pg_query($dbconn, $q) or die(pg_last_error());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>UTRC TwitterTracks</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bootstrap.css">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<meta name="twitter:widgets:theme" content="light">
<meta name="twitter:widgets:link-color" content="#55acee">
<meta name="twitter:widgets:border-color" content="#55acee">
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1>UTRC</h1>
<p>Twitter, for good</p>
</div>
<h3>You said...</h3>
<blockquote class="twitter-tweet" lang="en"><p><?php echo $row->tweet; ?></p>— <?php echo $row->username; ?> (<a style='font-size:12px;' href="https://twitter.com/<?php echo $row->username; ?>/status/<?php echo $row->tweetid; ?>"><?php echo date('F d',strtotime($row->ts)); ?></a>)</blockquote>
<!-- <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> -->
<!-- <a class="twitter-timeline" href="https://twitter.com/mario_giampieri" data-widget-id="579642852617097216">Tweets by @mario_giampieri</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> -->
<div id="selcont" class="container">
<h2> Tell us more about your trip</h2>
<br>
<h4>Thanks for agreeing to participate. Please choose a description that best fits your reason for travel from the list below:</h4>
<br>
<div class="form-group">
<div id="hsel">Please selected an answer from the list below</div>
<label for="sel1">What best describes your reason for travelling?</label>
<select class="form-control" id="sel1">
<option>Select an answer...</option>
<option>Work or school at regular location</option>
<option>Work or school activities at other places</option>
<option>Shop</option>
<option>Drop off or pick up someone</option>
<option>Eat meal out at a restaurant or diner</option>
<option>Recreation / entertainment</option>
<option>Social / visit friends or relatives</option>
<option>Other family or personal business (health care, religious activities, etc.)</option>
<option>None of the above</option>
</select>
</div>
<br>
<p>Thanks again for your participation!</p>
<button id="submitbutton" type="button" class="btn btn-default">Submit >></button>
</div>
<br>
<div class="footer">
<h5>PROJECT PURPOSE</h5>
<p>This survey is conducted as part of a research project hosted at Hunter College, City University of New York. The goal is to develop machine learning techniques than can automatically figure out problems in public transport network based on social media. For this part, we need your help: By assigning one of the above categories to your previously posted tweet, you help us train our machine learning algorithm. The goal is to include social media in the monitoring of the public transport network, and ultimately improve service for all users.</p>
<p>Disclaimer: Your participation in this research study is entirely voluntary. You can decide to withdraw your consent and stop participating in the research at any time.</p>
<p>If you have any questions, comments or concerns about the research, please contact Carsten Kessler (@carstenkessler, carsten.kessler@hunter.cuny.edu)</p>
<p>
If you have questions about your rights as a research participant, or you have comments or concerns that you would like to discuss with someone other than the researchers, please call the CUNY Research Compliance Administrator at 646-664-8918.
</p>
<p>Alternately, you can write to:
<br/><br/>
CUNY Office of the Vice Chancellor for Research<br/>
Attn: Research Compliance Administrator<br/>
205 East 42nd Street<br/>
New York, NY 10017
</p>
<!-- <h5>WHO WE ARE</h5>
<p>Duis sit amet accumsan tortor, eu condimentum nulla. Cras pulvinar nibh vitae elit varius, eget lacinia felis molestie. Aliquam commodo ipsum convallis purus condimentum interdum. Etiam suscipit accumsan sodales.</p>
<h5>PRIVACY & LEGAL</h5>
<p>Morbi tellus mi, blandit sed lacinia ut, luctus et arcu. Sed venenatis at ex in aliquet. Vestibulum scelerisque rutrum enim sollicitudin dictum. Vivamus laoreet eleifend lacus. Duis in egestas massa. Aenean mollis sed lacus id venenatis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vestibulum dignissim risus sit amet lacus molestie, facilisis aliquam enim scelerisque. Aenean id nunc ut est elementum scelerisque non non magna. Nunc congue augue sed hendrerit pulvinar. Ut a sapien sapien. Aliquam lobortis erat in magna varius condimentum. Aliquam lobortis lacinia augue id efficitur. Suspendisse efficitur et justo a lobortis. Phasellus mi diam, pharetra eu arcu quis, efficitur laoreet nunc.</p> -->
</div>
<script>
var key = "<?php echo $row->id; ?>";
$('#submitbutton').on('click', function() {
if ($('#sel1').val() == "Select an answer...") {
$('#hsel').show();
} else {
$('#hsel').hide();
var output = {key:key, class: $('#sel1').val()};
$.ajax({
url: "addclassification.php",
dataType: "json",
data: output,
success: function(result){
if(result.status == 200)
$('#selcont').html("<div style='font-size:15px;color:#0066ff'>Thank you for your participation.</div>");
}
});
}
});
</script>
</body>
</html>