forked from pinico42/revi.se
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quiz.php
52 lines (40 loc) · 1.04 KB
/
quiz.php
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
<?php
// Copyright © 2014 Max Penrose
?>
<?php
include 'private/pwds.php';
if(isset($_GET['u'])){
$uid = $_GET['u'];
$conn = mysqli_connect('localhost', $mysqlUsername, $mysqlPassword, 'revise');
$q = "SELECT * from topics where uid = '$uid';";
$query = mysqli_query($conn, $q);
$qarray = mysqli_fetch_array($query, MYSQLI_ASSOC);
$ids = $qarray['ids'];
$cmd = 'C:/Python27/python getquestions.py '.$ids.'';
$out = shell_exec($cmd);
$out = '{"vache":"cow"}';
} else {
header('Location: index.php');
}
?>
<?php
include "layouts.php";
$l = getLayout("basic.layout");
$l->writeHeader();
?>
<script type='text/javascript'>
var questions = <?php echo $out; ?>;
var uid = "<?php echo $uid; ?>";
var email = "<?php echo $_COOKIE['email']; ?>"
</script>
<div id='quiz'>
<h2 id='question'>Loading...</h2>
<input id='answer' onkeypress="return onEnter(event)"><br/>
<button id='asubmit' onclick='submitAnswer()'>Submit</button>
</div>
<div id='post-quiz'>
</div>
<script src='quiz.js' type='text/javascript'></script>
<?php
$l -> writeFooter();
?>