-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
140 lines (118 loc) · 2.99 KB
/
index.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
require('./conf_a.php');
// connect to db and build list of threads
$con=mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
// Check connection
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>talk.st-util.com - List Threads</title>
<link rel="stylesheet" type="text/css" href="index.css" media="all">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".btn-slide").click(function(){
$("#panel").slideToggle("slow");
$(this).toggleClass("active"); return false;
});
});
</script>
<script type="text/javascript">
function validAt() {
var xx = document.forms["commentAt"]["user"].value;
var xy = document.forms["commentAt"]["title"].value;
var xz = document.forms["commentAt"]["post"].value;
if ( xx == null || xx == "") {
alert("User is a required field - try again");
return false;
}
if ( xy == null || xy == "") {
alert("Your comment requires a title - try again");
return false;
}
if ( xz == null || xz == "") {
alert("Comment is a required field - try again");
return false;
}
}
</script>
</head>
<body>
<div id="panel">
<!-- slide panel -->
<center><br><br>
<form name="commentAt" method="post" action="add.php" style="dark-matter" onsubmit="return validAt()">
<label>
<span>User :</span>
<input type="text" name="user"/><br>
</label>
<label>
<span>Title :</span>
<input type="text" name="title"/><br>
</label>
<label>
<span> </span>
<textarea id="post" name="post" placeholder="Your Comment" rows="4" cols="50"></textarea><br>
</label>
<label>
<span> </span>
<input type="submit" value="Create New Thread">
</label>
</form>
</center>
</div>
<p class="slide"><a href="#" class="btn-slide">New Thread</a></p>
<br>
<h1>ST Talk - Employee Forum</h1>
<p class="meta">
<a href="index.php">HOME</a>
<br>
Last activity: 19 mins ago
</p>
<?php
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="SELECT * FROM subject ORDER BY sub_time DESC";
if ($result=mysqli_query($con,$sql))
{
// Fetch one and one row
while ($row=mysqli_fetch_row($result))
{
?>
<div class="script" id="something">
<div class="header">
<h2>
<a href="thread_view.php?thread_id=<?php echo $row[0]; ?>" class="name">
<?php
echo $row[3]." ";
?>
</a>
</h2>
<span class="author"><?php
echo "<strong>Posted by: </strong>$row[2]";
?>
</span>
</div>
<div class="about">
<p class="description"><?php
echo "<strong>$row[3]</strong>";
echo "<br>$row[4]";
?><br></p>
<h3>Posted:</h3>
<?php echo "$row[1]"; ?>
</div>
</div>
<?php
}
// Free result set
mysqli_free_result($result);
}
mysqli_close($con);
?>
</body>
</html>