<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//NL">
<HTML>
   <HEAD>
      <TITLE>
      Incomming calls registration.
      </TITLE>
   </HEAD>
   <META HTTP-EQUIV="REFRESH" CONTENT="120">
<BODY>   

<?php
// db variables
// inserts variables accordingly
include ("config.php");
 // Verbinding maken, een database selecteren
 $link = mysql_connect($dbhost, $dbuser, $dbpass)
     or die("Kan geen verbinding maken");
 mysql_select_db($dbname)
     or die("Kan geen database selecteren");

 // Een SQL query uitvoeren
 $query = "SELECT phonenr, name, id FROM names ORDER BY names.name";
 $result = mysql_query($query)
     or die("Fout bij uitvoeren query");

 // Printen resultaten in HTML
 print "<table align=center border=0>\n";
 print "<td bgcolor='#33CCFF' width=150 align=center><b>PHONENUMBER</b></td>";
 print "<td bgcolor='#33CCFF' width=150 align=center><b>NAME</b></td>";
 print "<td bgcolor='#33CCFF' width=50 align=center><b>ID</b></td>";
 
 $BGCOLOR="#EEEEEE";
 while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
     if ($BGCOLOR == "#EEEEEE") {
        $BGCOLOR="#FFFFFF";
     } else {
        $BGCOLOR="#EEEEEE";
     }
     print "\t<tr bgcolor='$BGCOLOR'>\n";
     print "\t\t";
     print "<td width=150 align=center>$line[phonenr]</td>";
     print "<td width=400 align=center>$line[name]</td>";
     print "<td width=50 align=center>$line[id]</td>";
     print "\n";
     print "\t</tr>\n";
   }
 print "</table>\n";

 // Resultaat-set vrij maken
 mysql_free_result($result);
 // Verbinding afsluiten
 mysql_close($link);
 ?>

</BODY>
</HTML>
