Happy happy joy joy, www.infodrom.ffis.de is up!
[infodrom.org/www.infodrom.org] / src / linx / index.wml
1 #include <infodrom.style>
2 #include <linx.style>
3 #include <db.style>
4 #include <phptools.inc>
5
6 <page title="Infodrom Linx">
7 <linxtop>
8
9 <h3>Most recent entries</h3>
10
11 <browser_with_tables>
12 <?
13   $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
14                or die("Unable to connect to SQL server");
15
16 #  pg_exec ($dbh, "SET DateStyle = 'ISO'"); // ignore or die("Datenbank-Abfrage!");
17
18   $query = "SELECT url,subject,category,changed FROM links ORDER BY changed DESC,category,subject";
19   $sth = pg_exec ($dbh, $query);
20
21   $tables = browser_with_tables();
22   $category = "";
23   if (pg_NumRows ($sth) > 0) {
24     if ($tables) {
25       echo ("<div align=\"center\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"75%\" summary=\"\">");
26     }
27     for ($nr=0; ($nr < pg_NumRows ($sth)) && ($nr < <recent>); $nr++) {
28       $row = pg_fetch_array ($sth, $nr);
29
30       if ($category != $row['category']) {
31         if (!$tables) {
32           if ($nr > 0) {
33             echo ("</ul>");
34           }
35           printf ("<b><a href=\"lookup.php3?category=%s\">%s</a></b><br><ul>", $row['category'], $row['category']);
36         } else {
37           printf ("<tr><td bgcolor=\"#<linxcolh>\"><a href=\"lookup.php3?category=%s\">"
38                  ."<font face=\"Helvetica,Arial\">%s</font></a></td></tr>",
39                  $row['category'], $row['category']);
40         }
41         $category = $row['category'];
42       }      
43       if (!$tables) {
44         printf ("<li><a href=\"%s\">%s</a></li>", $row['url'], $row['subject']);
45       } else {
46         printf ("<tr><td bgcolor=\"#<linxcold>\"><a href=\"%s\">"
47                ."<font face=\"Helvetica,Arial\">%s</font></a></td></tr>",
48                $row['url'], $row['subject']);
49       }
50     }
51     if (!$tables) {
52       echo ("</ul>");
53     } else {
54       echo ("</table></div>");
55     }
56   }
57 ?>
58
59
60 <linxbot>
61 </page>
62
63 # Local variables:
64 # mode: indented-text
65 # mode: auto-fill
66 # end: