f459a76e012e5052ac3878456b935df783fb55e7
[infodrom.org/service.infodrom.org] / src / Infodrom / logbook / public.wml
1 #include <infodrom.style>
2
3 <page func="Infodrom Oldenburg" title="Logbook">
4
5 <p>Public Logbook</p>
6
7 <table width=100% class=font border=0 cellspacing=3 bgcolor="#<cold>">\
8 <tr bgcolor=#<colh>>\
9 <th width=10%>Datum</th>\
10 <th width=10%>Category</th>\
11 <th width=80%>Titel</th></tr>
12
13 <?
14   $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
15                or die("Unable to connect to SQL server");
16
17   pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
18
19   $query = "SELECT id,teaser,category,created FROM logbook WHERE public=1 ORDER BY created DESC";
20   $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
21
22   for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
23     $row = pg_fetch_array ($sth, $nr);
24     $date = explode (" ", $row['created']);
25     $time = explode (":", $date[1]);
26     $date = explode ("-", $date[0]);
27     $date = sprintf ("%d.%d.%d %02d:%02d", $date[2], $date[1], $date[0], $time[0], $time[1]);
28
29     printf ("<tr><td align=\"right\">%s</td><td align=\"center\">%s</td><td><a href=\"show.php?id=%s\">%s</a>"
30            ." (<a href=\"http://www.infodrom.org/~joey/log/?%s\">pub</a>)</td></tr>",
31            $date, $row['category'], $row['id'], $row['teaser'], $row['id']);
32   }
33 ?>
34
35 </table>
36
37 </page>
38
39 # Local variables:
40 # mode: text
41 # mode: auto-fill
42 # end: