Baseline
[www.vanrenterghem.biz.git] / News / permalink.php~
1 <html>
2 <HEAD>
3    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-15">
4    <META NAME="Author" CONTENT="frederik.vanrenterghem@chello.be (Frederik Vanrenterghem)">
5    <META NAME="Description" CONTENT="Personal homepage - news">
6    <TITLE>http://frederik.gotdns.org:1976 - News</TITLE>
7 </HEAD>
8 <BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EF" VLINK="#55188A" ALINK="#FF0000">
9 <?php
10 // Print the header
11 printf("<!--HEADER-->\n");
12 include("../header.shtml");
14 // Check the input
15 // We expect a $berichtID=YYYY-MM-DD as parameters
17 if(!isset($berichtID)){die ('<BR>Please specify a date when invoking this script.');}
19 if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $berichtID, $regs)) {
20    $datum="$regs[1]$regs[2]$regs[3]";
21 } else {
22    die ('<BR>Invalid date format. Check the URL or <a href="/About/index.shtml">contact the webmaster</a> if this problem persists.');
23 }
26 // Print the page title
27 printf("<BR><H1>News from $berichtID</H1>\n\n");
29 // Define the variables
31 $dbserver="localhost";
32 $usernaam="frederik";
33 $paswoord="Fred1210";
34 $database="website";
35 $tabel="newsContent";
36 $maxShown=5;
40 // -- Table structure for table 'newsContent'
41 // --
42 //
43 // CREATE TABLE newsContent (
44 //   title varchar(40) default NULL,
45 //   date date default NULL,
46 //   body text
47 // )
49 // Connect to database
51 $db=mysql_connect($dbserver,$usernaam,$paswoord) or die ("Geen connectie met server");
52 mysql_select_db($database,$db) or die ("Database bestaat niet");
55 $resultatenreeks=mysql_query("SELECT * FROM $tabel WHERE date=$datum") or die ('An error occured while retrieving data from the database. Please <a href="/About/index.shtml">contact the webmaster</a> if this problem persists.');
58 while ($resultatenrij = mysql_fetch_row($resultatenreeks)) {
60 // Put the results in a table, one table per result
61                 printf("<!--NEWSITEM-->\n");
62                 printf("<table border='0' cellpadding='0' cellspacing='0' width='100%%' summary=''><tr><td><table bgcolor='#000084' border='0' cellpadding='0' cellspacing='0' width='100%%' summary=''>
63 <tr><td valign='top'><img src='/Pics/newsitem_ul.png' align='left' border='0' hspace='0' vspace='0' alt='cornerul' width='16' height='16'><font color=white><B>
64 %s</B></font>
65 </td><td align='right' valign='top'><img src='/Pics/newsitem_ur.png' align='right' border='0' hspace='0' vspace='0' alt='cornerur' width='16' height='16'><font color=white><B>
66 %s </B></font></td></tr></table></td></tr><tr><td>
67 %s <BR><BR></td></tr></table>\n\n",
68                 $resultatenrij[0], $resultatenrij[1], $resultatenrij[2]);
70 }
72 // Print the footer
73 printf("<!--FOOTER-->\n");
74 include("../footer.php");
75 ?>
77 </BODY>
78 </HTML>