/
viewhtml.php
74 lines (73 loc) · 2.61 KB
/
viewhtml.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
<?php
include("include/common.php");
$conn = mysql_connect(DBHOST, DBUSER, DBPASSWORD) or die(mysql_error());
mysql_select_db(DBDATABASE, $conn) or die(mysql_error());
$fields = "dayname(eventdate) as weekday,"
. "dayofmonth(eventdate) as monthday,"
. "hour(eventtime) as hour,"
. "minute(eventtime) as minute,"
. "eventdate,eventtime,eventduration,name,email,hideemail,phone,hidephone,"
. "weburl,webname,contact,hidecontact,title,tinytitle,"
. "audience,printdescr,newsflash,image,imageheight,imagewidth,"
. "reqdate,timedetails,repeats,address,locdetails,area,"
. "printphone,printemail,printweburl,printcontact";
$result = mysql_query("SELECT $fields FROM calendar ORDER BY eventdate,eventtime", $conn) or die(mysql_error());
$prevdate = "";
while ($record = mysql_fetch_array($result)) {
if ($record[eventdate] != $prevdate) {
if ($prevdate != "")
print "<hr>\n";
print "<h2>" . $record[weekday] . " June " . $record[monthday] . "</h2>\n";
$prevdate = $record[eventdate];
}
print "<p><strong>";
print htmlspecialchars(strtoupper($record[title]));
if ($record[area] == "V")
print " (Vancouver)";
print "</strong><br>\n";
print "<em>";
print htmlspecialchars($record[address]);
if ($record[locdetails] != "") {
print " (".htmlspecialchars($record[locdetails]).")";
}
print ", ";
print "<br>\n";
if ($record[eventtime] == "12:00:00")
$time = "Noon";
else {
$time = $record[hour];
if ($time > 12)
$time = $time - 12;
if ($record[minute] >= 1 && $record[minute] <= 9)
$time = $time . ":0" . $record[minute];
else if ($record[minute] >= 10)
$time = $time . ":" . $record[minute];
if ($record[hour] >= 12)
$time = $time . "pm";
else
$time = $time . "am";
}
$time = hmmpm($record[eventtime]);
print $time;
if ($record[eventduration] != 0)
print " - ".endtime($time, $record[eventduration]);
if ($record[timedetails])
print ", " . htmlspecialchars($record[timedetails]);
print "</em> \n";
print htmlspecialchars($record[printdescr]);
if ($record[audience] == "F")
print "\nFamily Friendly.";
else if ($record[audience] == "A")
print "\n21+ Only.";
print " " . htmlspecialchars($record[name]);
if ($record[printphone] && $record[phone] != "")
print ", " . htmlspecialchars($record[phone]);
if ($record[printemail] && $record[email] != "")
print ", " . htmlspecialchars($record[email]);
if ($record[printcontact] && $record[contact] != "")
print ", " . htmlspecialchars($record[contact]);
if ($record[printweburl] && $record[weburl] != "")
print ", " . htmlspecialchars($record[weburl]);
print "\n";
}
?>