#!/usr/bin/perl -w
use CGI::Carp qw(fatalsToBrowser);

# ------------------------------------------------------------ #
use DBI ;
use CGI qw(:standard);
require "conf/connect.cgi" ;
require "conf/css.cgi"     ;

# ------------------------------------------------------------ #

$style = &getStyle(param('style'));

$truckurl = 'http://mtm2.com/~trucks';

print "Content-type: text/html\n\n";

# ------------------------------------------------------------ #

print <<EOM;
<HTML>
  <head>
    <title>expo2003 - Trucks</title>
      <script language="Javascript">
        if (top.location != location) top.location.href = location.href; 
      </script>
    <script TYPE="text/javascript" LANGUAGE="JavaScript" src="jstrucks.js"></script>
    <link HREF="$style" REL=STYLESHEET TYPE="text/css">
  </head>
  <BODY id=all>

<!--    Header Line     -->
      <center><h2>expo2003 - Trucks</h2></center>

<br>
EOM

# ------------------------------------------------------------ #
&ro_connect('trucks');

$SQL = <<SQL;
	SELECT *       
	FROM   trucks
	WHERE  ( status = '3' ) 
	ORDER by ID DESC
SQL
&Do_SQL;

# ------------------------------------------------------------ #
print <<EOM;
    <table align=center cellspacing=0 cellpadding=5>
      <tr class=header2>
        <td colspan=6>$rv trucks</td>
      </tr>
      <tr class=header1>
        <td>Truck</td>
        <td>Maker</td>
        <td>DL</td>
        <td>Type</td>
        <td>Date</td>
        <td>Size</td>
      </tr>
EOM
# ------------------------------------------------------------ #

while ($ary = $sth->fetchrow_hashref) {
	$ID  = $ary->{'ID'} ;
	$status = $ary->{'status'} ;
#	$dir = $ary->{'dir'} ;
#	$file = $ary->{'file'} ;
	$truck = $ary->{'truck'} ;
	$maker = $ary->{'maker'} ;
	$date = $ary->{'date'} ;
	$type = $ary->{'type'} ;
	$size = $ary->{'size'} ;
	$DL  = $ary->{'DL'} ;
 	$pic = $ary->{'pic'} ;
#	$description = $ary->{'description'} ;



$link = qq(<a href="${truckurl}/dl.cgi?dl=${ID}"><font class=nf>${truck}</font></a>);

if ($pic) {
$detail = qq(<a href="javascript:MyPic($ID)"><font class=nf>$type</font></a>);
}
else {
$detail = $type;
}

print qq(<tr><td nowrap>${link}</td><td nowrap>${maker}</td><td><font size=1>${DL}</font></td><td>${detail}</td><td><font size=1>${date}</font></td><td>${size}k</td></tr>\n);
}

# ------------------------------------------------------------ #

# HereDoc output
print <<EOM;
          </table>
<br><br><br>

<br></BODY></HTML>
EOM


$sth->finish() ;
$dbh->disconnect();

$style = undef ;
$op_a = $op_d = $op_n = $op_m = $op_t = $op_s = $op_w = $d = $s = undef ;
$SQL = $ary = $sth = $dbh = $rv = undef ;
$link = $ID  = $status = $truck = $maker = $date = $type = $size = $DL  = $pic = undef ;


# EOF


