-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.php
More file actions
74 lines (57 loc) · 1.48 KB
/
examples.php
File metadata and controls
74 lines (57 loc) · 1.48 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
<?php
if (!isset($_GET['course']))
{
echo "No course specified for code examples - please try again!";
exit;
}
require("db.php");
$course = strtoupper($_GET['course']);
$section = strtoupper($_GET['section']);
?>
<body>
<head>
<title>Code Examples - <?=$course?></title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="style.css">
<script>
$(document).ready(function () {
$('#examples .excontent').hide();
$('#examples .exname').click(function () {
$(this).next().toggle();
return false;
});
});
</script>
</head>
<body>
<div class="major">
<h1>Code Examples - <?=$course?> <?=$section?></h1>
<p>(To see a complete set in one document, go
<a href="examples_all.php?course=<?=$course?>§ion=<?=$section?>">HERE</a>.)</p>
<div id="examples">
<?php
$result=mysql_query("select date_format(day, '%a %c/%e'), title, contents from pastebin where course='"
. $course . "' and section='" . $section . "' order by day desc");
while ($row = mysql_fetch_row($result))
{
$day = $row[0];
$title = $row[1];
$contents = $row[2];
$contents = str_replace("<", "<", $contents);
$contents = str_replace(">", ">", $contents);
?>
<div class="chunk">
<div class="exname"><a href="#"><?=$day?> - <?=$title?></a></div>
<div class="excontent">
<pre>
<?=$contents?>
</pre>
</div>
</div>
<?php
}
?>
</div>
</div>
</body>