-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.php
84 lines (74 loc) · 2.42 KB
/
view.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
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>
<html lang="en">
<head>
<title>Westview Tutoring</title>
<link href="bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="jquery.js"></script>
<script>
var time = new Date().getTime();
$(document.body).bind("mousemove keypress", function(e) {
time = new Date().getTime();
});
function refresh() {
if(new Date().getTime() - time >= 30000)
window.location.reload(true);
else
setTimeout(refresh, 10000);
}
setTimeout(refresh, 10000);
</script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="index.php">Westview Tutoring</a>
<div class="nav-collapse">
<ul class="nav">
<li><a href="index.php">Home</a></li>
<li><a href="chat.php">Chat</a></li>
<li><a href="forum.php">Forum</a></li>
<li><a href="tutor.php">Tutors</a></li>
</ul>
<ul class = "nav pull-right">
<li><a href="contact.php">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<br><br><br>
<div class = "container">
<?php
include("gmongo.php");
$id = $_GET['id'];
global $id;
$collection = $db->posts;
$doc = $collection->findOne(array( '_id' => new MongoId($id) ));
global $doc;
echo "<p>Save this link to get back to your post later<br>";
echo "<input class = 'span10' type = 'text' value = 'wvtutor.com/view.php?id=".$id."'></input></p>";
echo "<h4>Question: </h4>".$doc['post']."<br> -".$doc['name']."<br>";
?>
<br><b>Post an Answer:</b>
<form action='commenthandler.php' method='GET' id='FORM'>
<?php echo "<input type = 'hidden' name = 'id' value = '".$id."'>";?>
<input class = 'span9' type='text' name='comment' ><br>
<?php
session_start();
$_SESSION['user'] = array( 'name' => "Cheng"); //get rid of this on deploy
$user = $_SESSION['user'];
echo "<input type = 'hidden' name = 'name' value = '".$user['name']."'>" ?>
<input class = 'btn btn-primary' id = 'submit' type='submit' value='Post'>
</form>
<div id='comments'>
<?php
foreach($doc['comments'] as $comment)
{
echo "<p>".$comment['name'].": ".$comment['comment']."</p>";
}
?>
</div>
</div>
</body>
<html>