#!/usr/local/bin/perl
#!C:\bin\perl\bin\perl.exe
#!/usr/bin/perl/
# use one of the above lines to set the path to perl on your server
##########################################################################################

#####################################################################
# get parameters from the file
open(PAR,"<param14.dat");
@params = <PAR>;
close(PAR);
foreach $line (@params) {
	@option = split(/"/,$line);
	if (@option[0] =~ 'method') {$method = @option[1]}

	if (@option[0] =~ 'colortx') {$colortx = @option[1]}
	if (@option[0] =~ 'colorbg') {$colorbg = @option[1]}
	if (@option[0] =~ 'coloral') {$coloral = @option[1]}
	if (@option[0] =~ 'colorvl') {$colorvl = @option[1]}
	if (@option[0] =~ 'sizetx') {$sizetx = @option[1]}
	if (@option[0] =~ 'nametx') {$nametx = @option[1]}
	if (@option[0] =~ 'pathcgi') {$pathcgi = @option[1]}
	if (@option[0] =~ 'pathdata') {$pathdata = @option[1]}
	if (@option[0] =~ 'pathmail') {$pathmail = @option[1]}
	if (@option[0] =~ 'urlcgi') {$urlcgi = @option[1]}
	if (@option[0] =~ 'urldata') {$urldata = @option[1]}
	if (@option[0] =~ 'htmlfoot') {$htmlfoot = @option[1]}
	if (@option[0] =~ 'htmlhead') {$htmlhead = @option[1]}
	if (@option[0] =~ 'title') {$title = @option[1]}
	if (@option[0] =~ 'welcome') {$welcome = @option[1]}
	if (@option[0] =~ 'confirm') {$confirm = @option[1]}
	if (@option[0] =~ 'emailstep') {$emailstep = @option[1]}
	if (@option[0] =~ 'emailsent') {$emailsent = @option[1]}
	if (@option[0] =~ 'hellotext') {$hellotext = @option[1]}

	if (@option[0] =~ 'priority') {$priority = @option[1]}
	if (@option[0] =~ 'status') {$status = @option[1]}
	if (@option[0] =~ 'category') {$category = @option[1]}
	if (@option[0] =~ 'products') {$products = @option[1]}
	if (@option[0] =~ 'message') {$message = @option[1]}

	if (@option[0] =~ 'submit') {$submit = @option[1]}
	if (@option[0] =~ 'mailto') {$mailto = @option[1]}
	if (@option[0] =~ 'subject') {$subject = @option[1]}

	if (@option[0] =~ 'showip') {$showip = @option[1]}
}


#####################################################################
# get user-defined html for header and footer
open(HD,"<$htmlhead");
@head = <HD>;
close(HD);
open(FT,"<$htmlfoot");
@foot = <FT>;
close(FT);

$ft = "<FONT FACE=\"$nametx\" COLOR=\"$colortx\" SIZE=\"$sizetx\">";

##########################################################################################
# print the support form

print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>\n";
print " $title\n";
print "</TITLE>\n";
print "</HEAD>\n";

#print header
foreach $linehd (@head) {
	print "$linehd\n";
}


print "<BODY BGCOLOR=\"$colorbg\">\n";
print "$ft\n";

print " <P ALIGN=\"left\">\n";

print "$emailsent\n";
print "<BR><BR>\n";

##########################################################################################

&date;

# beg ad tag
print "$ft\n";
print " <small class=small>\n";
print "  <BR>\n";
print "  Form and scripts provided by <a href=\"http://www.softopia.com\">www.softopia.com</a>.<br>\n";
print "  iTrack v1.4 copyright © 1996-2000\n";
print "  <BR>\n";
print " </small>\n";
print "</FONT>\n";
# end ad tag

foreach $lineft (@foot) {
	print "$lineft\n";
}
print "</BODY>\n</HTML>\n";



#####################################################################
# get the time
sub date {
   ($sec,$min,$hour,$mday,$month,$year) = localtime(time);

   if ($sec < 10) {
      $sec = "0$sec";
   }
   if ($min < 10) {
      $min = "0$min";
   }
   if ($hour < 10) {
      $hour = "0$hour";
   }

   $year = $year + 1900;
   $month = $month + 1;
   $date = "$month-$mday-$year $hour\:$min\:$sec";
   chop($date) if ($date =~ /\n$/);

   $time = time();
   
}
