#!/usr/local/bin/perl -w


#both left or right ajustiment, when length is 0, will print the string
#put extra :: at the end of .def file to avoid 
# to print out last field as trash

if (@ARGV) {
 print "Content-Type: text/html \n\n";
 print "<p>$ARGV[0]\n";
}
else {
 print "Content-Type: text/html \n\n";
}
print "<HTML>\n";

print '<body bgcolor="#66FFFF">'; 
print '<font color="#660066">'; 

open(def_file,"/home/chrislu/http_root/jws/cgi-bin/bid.def") || print "die<p>";

@lines = <def_file>;
@colnames = split(":",$lines[0]);
close(def_file);


print "<FORM 
ACTION=\"http://bitcoinshell.mooo.com/users/chrislu/jws/cgi-bin/setbid.pl\">\n";

$i=0;
while (($colnames[${i}]) && ($colnames[${i}] ne "Date")) {
  if ($colnames[${i}] eq "bid") {
    print "Buyer email address<INPUT NAME=\"$colnames[${i}]\" VALUE=\"\"><p>\n";
  }
  else {
  print "$colnames[${i}] <INPUT NAME=\"$colnames[${i}]\" VALUE=\"\"><p>\n";
  }
  $i += 1;
}
print "<p><INPUT TYPE=\"submit\"> </FORM>";

print "</HTML>";


