<?php
    // Change these to suit your individual configuration
    $MYSQL_USER="";
    $MYSQL_PW="";
    $MYSQL_HOST="localhost";
    $MYSQL_DB="ddybot";
?>

<html>
<head>
 <title>Diverse Development's Y!Bot -- MySQL Statistics</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
 p{
  font-size: 9pt;
 }

 a.link{
  font-weight: bold;
  color: #5588BB;
  text-decoration: none;
 }
 a.link:hover{color: silver}
 
 body{
  font-family: Arial, Helvetica, sans-serif;
  background-color: white;
}  
</style>
</head>

<body>

<h3>Diverse Development's Y!Bot -- MySQL Statistics</h3>
<h4>Packet type captured: YCHT Talk packets</h4>

<table border="0" width="95%">

<!-- Table heading -->
<tr>
    <td bgcolor="#eeeeee"><p><b>Time</b></p></td>
    <td bgcolor="#eeeeee"><p><b>Room</b></p></td>
    <td bgcolor="#eeeeee"><p><b>User</b></p></td>
    <td bgcolor="#eeeeee"><p><b>Message</b></p></td>
</tr>

<?php
    // Connect to the database

    mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PW)
        or die('Error connecting to MySQL server');

    mysql_select_db($MYSQL_DB)
        or die('Error selecting MySQL db');

    $query='SELECT DATE_FORMAT(time,"%m/%d/%y %T"),room,uname,msg FROM talk';

    $result=mysql_query($query)
        or die("Error performing query on database");

    // display stuff
    $colflag=true;
    while(list($time,$room,$uname,$msg)=mysql_fetch_row($result)){
        if($colflag){
            $color="#ccddee";
            $colflag=false;
        }else{
            $color="white";
            $colflag=true;
        }

        echo "<tr><td width=105 bgcolor=#eeeeee>"
            ."<p>$time</font></td>";

        echo "<td bgcolor=$color width=105><p><a class=link href="
            ."http://chat.yahoo.com/?room=$room>$room</td>";

        echo "<td bgcolor=$color width=105><p><a class=link href="
            ."http://profiles.yahoo.com/$uname>$uname</a></td>";

        echo "<td bgcolor=$color width=400><p>$msg</td></tr>";
    }
?>

</table>

<p>ddY!Bot Copyright 2002 by Justin Todd</p>

</body>
</html>
