#!/usr/bin/perl 
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
print "Content-type: text/html\n\n";

$step = param('step');

if ( (!defined $step) || ($step ne '2') ) {
    open(FILE, "contact.htm") || die("This file will not open");
        while(<FILE>) {
            print $_ ;
        }
    close(file);
 exit;
}
else {

# --------------
$mtmname = param('mtmname');
$from = $email = param('email');
$firstname = param('firstname');
$lastname = param('lastname');

$address1 = param('address1');
$address2 = param('address2');
$city = param('city');
$state = param('state');
$postal = param('postal');
$country = param('country');

$color = param('color');


@times = localtime(time); 
          $year =  sprintf("%04d",($times[5] + 1900)); 
          $month = sprintf("%02d",($times[4]+1)); 
          $day =   sprintf("%02d",($times[3])); 
$date = $year . "-" . $month . "-" . $day ;

# --------------
   $sendmail = '/usr/sbin/sendmail';
   $to = 'malibu350@karf.net,phineus@karf.net'; 
   $ip = $ENV{REMOTE_ADDR} ;
   $subject = "Expo 2003 - Contact info" ;
# --------------

$CONTENT = <<CONTENT;
         The following message was sent 
         to        :  $to
         subject   :  $subject

         mtmname   :  $mtmname
         email     :  $email
         firstname :  $firstname
         lastname  :  $lastname

         address1  :  $address1
         address2  :  $address2
         city      :  $city
         state     :  $state
         zip code  :  $postal
         country   :  $country

         color     :  $color

         Date:     :  $date

         IP        :  $ip
CONTENT

open(MAIL,"| $sendmail $to") || die("Could not send mail!") ;
    print( MAIL "To: $to \n"); 
    print( MAIL "From: $from\n"); 
    print( MAIL "Subject: $subject\n"); 
    print( MAIL "\n\n"); 
    print( MAIL "$CONTENT");
close(MAIL); 

print <<EOM;
<html>
  <head>
    <META HTTP-EQUIV="no-cache">
  </head>
    <BODY text=silver bgcolor=black>
      <div style="margin-left: 80px;margin-right: 80px">
        <p>
          <pre>
$CONTENT

         <a href="http://rhinoseros.com/~mtmg/contests/expo2003/">Back to the Expo page</a>
          </pre>
        </p>
     </div>
  </body>
</html>
EOM

}














