-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdirectory.php
66 lines (64 loc) · 1.97 KB
/
directory.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
<!DOCTYPE html>
<html>
<head>
<?php require 'db.php';
$user = $_COOKIE["user"];
$directory_listings = "";
$limit = 10;
if (isset($_POST["hf_limit"]) && $_POST["hf_limit"] != "") {
$limit += $_POST["hf_limit"];
$directory_listing = getDirectoryListings($limit);
}
?>
<script type="text/javascript" src="js/jquery-1.10.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#btn_see_more").on("click", function() {
$("#hf_limit").val($("#hf_limit").val() + 10);
$("#form1").submit();
});
});
</script>
</head>
<body>
<?php
if (logged_in()) {
echo "Logged in as ".$user.". <a href=\"logout.php\">Logout</a><br>\n";
include 'menu_bar.php';
echo "<form id='form1' name='form1' action='directory.php' method='post'>\n";
echo "<h1>Here are some examples of some successful projects that have been created using the workstation</h1>\n";
echo "<div id='directoryContainer'>\n";
if ($directory_listings == "") {
$directory_listings = getDirectoryListings($limit);
}
foreach ($directory_listings as $listing) {
echo "<div class='listing'>\n";
echo "<h4>".$listing["heading"]."</h4>\n";
echo "<a href=\"".$listing["destinationUrl"]."\"><img src=\"".$listing["imageUrl"]."\" alt=\"".$listing["imageAltText"]."\" /></a>\n";
echo $listing["description"]."\n";
echo "</div>\n";
}
echo "</div>\n";
echo "<input type='hidden' id='hf_limit' name='hf_limit' value='10' />\n";
echo "</form>\n";
} else {
header("Location: cms.php");
}
function getDirectoryListings($limit) {
$direcory_listings = array();
DBLogin("a8823305_audio");
$SQL = "SELECT * FROM directory_listings LIMIT ".$limit;
$result = DBQuery($SQL);
if ($result->num_rows == 0) {
echo "No rows found";
exit;
}
while ($row = $result->fetch_array(MYSQL_ASSOC)) {
$direcory_listings[] = $row;
}
DBC();
return $direcory_listings;
}
?>
</body>
</html>