1 #include <infodrom.style>
3 <page func="Infodrom Oldenburg" title="Statistics">
7 '<table class="font border" width="100%">
8 <tr bgcolor="#<colh>"><th width="10%">Count</th><th width="90%">Referer</th></tr>';
10 $tabrow = '<tr bgcolor="#%s"><td width="10%%" align="center">%d</td><td width="90%%"><a href="%s" title="%s">%s</a></td></tr>';
12 $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
13 or die("Unable to connect to SQL server");
16 $query = "SELECT id,name FROM ref_site ";
17 if (isset($_GET["site"]))
18 $query .= sprintf("WHERE id = %d ", $_GET["site"]);
19 $query .= "ORDER BY name";
20 $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
22 for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
23 $site = pg_fetch_array ($sth, $nr);
24 printf ('<h3 class="bar"><a href="<get-var WML_SRC_BASENAME>.php?site=%d">%s</a></h3>', $site["id"], $site["name"]);
29 "SELECT count(*) AS count,ref_origin.url,ref_origin.title
30 FROM ref_origin,ref_url,ref_log
31 WHERE ref_log.url = ref_url.id
32 AND ref_log.origin = ref_origin.id
34 GROUP BY ref_origin.url,ref_origin.title
35 ORDER BY count DESC", $site["id"]);
37 if (!isset($_GET["site"]))
38 $query .= " LIMIT 10";
40 $sth2 = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
41 for ($i=0; $i < pg_NumRows ($sth2); $i++) {
42 $row = pg_fetch_array ($sth2, $i);
43 if (strlen($row["title"])) {
44 $title = substr($row["title"], 0, 80);
46 $title = htmlentities(substr($row["url"], 0, 80));
48 $color = $color == "<cold>"?"<coln>" : "<cold>";
49 printf ($tabrow, $color, $row["count"], $row["url"], htmlentities($row["url"]), $title);
55 <div style="padding-top: 1em"></div>