#!/usr/bin/perl

use CGI;

use Mysql;

require('config.pl');

$query = new CGI;
get_params();
$dbh = Mysql->connect("$db_host","$db","$db_user","$db_password");


print $query->header;

get_colors();


$select_query = "SELECT *, WEEKDAY(datee) as dow  FROM beckband order by  datee, id";





$sth = $dbh->query($select_query);

print <<EOP;

		<br><br>
		<center><em><font color="orange" font face='Comic San MS'><strong><em>
                <big><h1><big>The Dahman Beck Band</big></big></em></strong>
		<hr width='33%'></font>
		
		</big></big></h1>

EOP
 

  while (%info = $sth->fetchhash){


     $date1 = `/bin/date --date="$info{datee}" +"%B %e, %Y"`;

     $today = `/bin/date +%Y%m%d`-1;
     chomp($today);  
   
     $info{datee} =~ /(\d\d\d\d)-(\d\d)-(\d\d)/;

     

     $date = $info{'datee'} ;
     $month = substr($date,5,2); 
     $day = substr($date,8,2);
     $year = substr($date,0,4);
     
     $today = `/bin/date +%Y-%m-%d`; 
     chomp($today);
          
       
        if ($month eq "01" ){
           $month = "January";

        };
        if ($month eq "02" ){
           $month = "February";

        };

        if ($month eq "03" ){
           $month = "March";
                           
        };
        if ($month eq "04" ){
           $month = "April";

        };
        if ($month eq "05" ){
           $month = "May";

        };
        if ($month eq "06" ){
           $month = "June";

        };  
        if ($month eq "07" ){
           $month = "July";

        };
        if ($month eq "08" ){
           $month = "August";

        };
        if ($month eq "09" ){
           $month = "September";

        };
        if ($month eq "10" ){
           $month = "October";

        };
        if ($month eq "11" ){
           $month = "November";

        };
        if ($month eq "12" ){
           $month = "December";

        };
        
        if (substr($day,0,1) eq "0" ){
           $day = substr($day,1,1);

        };
     
        
       $dow="";

      



        if ($info{'dow'} eq "1" ){
           $dow = "Tuesday";
        };
  

        if ($info{'dow'} eq "2" ){
           $dow = "Wednesday";
        };


        if ($info{'dow'} eq "3" ){
           $dow = "Thursday";
        };

        

        if ($info{'dow'} eq "4" ){
           $dow = "Friday";
        };
    

        if ($info{'dow'} eq "5" ){
           $dow = "Saturday";
        };      

         if ($info{'dow'} eq "6" ){
           $dow = "Sunday";
        };


        if ($info{'dow'} eq "7" ){
           $dow = "Monday";
        };





     $today = `/bin/date +%Y%m%d`-1;
     chomp($today);

     $info{datee} =~ /(\d\d\d\d)-(\d\d)-(\d\d)/;


      $date = $1.$2.$3;
      $dateee = $info{datee};
      
    
   if ($date > $today ){

         

     print "<font color = 'red'><h2><bold>$dow,  $month $day<h2>
     <font color = 'green'> $info{'wheree'}
     <h3><font color = 'orange'>  $info{'timee'}<br><font color = 'navy'>
     $info{'other'}

     </big></em><h4><font color = 'black'> $info{'directions'}

     <hr width='33%'></font>";

   };

}































