-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforum.php
More file actions
125 lines (102 loc) · 3.46 KB
/
forum.php
File metadata and controls
125 lines (102 loc) · 3.46 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Forums</title>
<link href="bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//Get comments
$.get('spitter.php', function(data) {
$('#comments').append(data);
});
//Submit Handler
$("#FORM").submit(function(e) {
// stop form from submitting normally
e.preventDefault();
$('#submit').attr('disabled', 'disabled');
$.post('controller.php',
$('#FORM').serialize(),
function() {
$("#status").show();
$("#status").html("<p><font color = '#308014'>Submitted Successfully!</font></p>");
$("#status").hide(2000);
});
$('input:text').val('');
//FANCY FANCY
setTimeout(function() {
$('#submit').removeAttr('disabled');
},1850);
//get some new stuff
$.get('spitter.php', function(data) {
$('#comments').html(data);
});
});
});
</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="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>
<div class = "container">
<p>Give feedback on forums at <b>wv.tutor@gmail.com</b><p>
<h2>Forums <small>beta</small></h2>
<p>Post your questions here.</p>
<!-- FORM !-->
<div id = 'loader'></div>
<div id = "status"></div>
<?php
session_start();
$_SESSION['user'] = array( 'name' => "Cheng"); //get rid of this on deploy
$user = $_SESSION['user'];
if(!(isset($_SESSION['user'])))
{
echo "
<div id = 'subby'>
<form action='/' method='post' id='FORM'>
<input class = 'span10' type='text' name='post' disabled><br>
<input class = 'btn btn-primary' id = 'submit' type='submit' value='Post' disabled>
</form>
</div>
<a href = 'verify.php'>You need to connect with facebook to submit a post. (Hit this link,
verify and comeback to the forums)</a><br><br>
<div id='status'></div>
";
}
else
{
//global $user;
//$user = $_SESSION['user'];
//dun forget about shit up here
echo "
<div id = 'subby'>
<form action='death' method='post' id='FORM'>
<input type = 'hidden' value = ".$user['name']." name = 'name'>
<input class = 'span10' type='text' name='post'><br>
<input class = 'btn btn-primary' id = 'submit' type='submit' value='Post'>
</form>
</div>
<div id='status'></div>
";
}
?>
<div id ="comments"></div>
</div>
</body>
</html>