All pastes #209029 Raw Edit

form cgi

public text v1 · immutable
#209029 ·published 2006-10-18 23:50 UTC
rendered paste body
this is the part of the script that uses the parse subroutine

if ($page eq '1'){
   $error = "ZIP Code<br>\n" unless $zip;
   $error .= "Subscription Type<br>\n" unless $subtype;
   if ($error ne ''){
      &parse('error.html');
   } else {
      if ($subtype eq '1'){
         &parse ('index2.html');
      } else {
         &parse ('index-r.html');
      }
   }
}

this is the parse sub that is supposed to parse index2.html, it makes index2 reder as text????

sub parse{
   print "Content-type: text/html\n\n";
   $htmlfile = shift(@_);
   if ($mode eq 'test'){
      open INFILE,("</var/www/html/subscription/test_html/$htmlfile") or die "open failed. reason: $!";
   } else {
     open INFILE,("</var/www/html/subscription/html/$htmlfile") or die "open failed. reason: $!";
   }
   while (<INFILE>){
      if ($mode eq 'test'){
         s/(<title>.*)(<\/title>)/$1 TEST$2/i;
      }
      s/\"imgs\//\"\/imgs\//g;
      s/\%errors\%/$error/g;
      s/\%zip\%/$zip/g;
      s/\%subtype\%/$subtype/g;
      s/\%subfreq\%/$subfreq/g;
      s/\%subfreqtxt\%/$subfreqtxt/g;
      s/\%price1\%/$price1/g;
      s/\%price2\%/$price2/g;
      s/\%price3\%/$price3/g;
      s/\%price4\%/$price4/g;
      s/\%startdate\%/$startdate/g;
      s/\%startdateoptions\%/$startdateoptions/g;
      s/\%name\%/$name/g;
      s/\%address\%/$address/g;
      s/\%city\%/$city/g;
      s/\%state\%/$state/g;
      s/\%card_NC\%/$card_NC/g;
      s/\%card_SC\%/$card_SC/g;
      s/\%phone\%/$phone/g;
      s/\%gift\%/$gift/g;
      s/\%chargefreq\%/$chargefreq/g;
      s/\%expyears\%/$expyears/g;
      s/\%cardtype\%/$cardtype/g;
      s/\%cardnum1\%/$cardnum1/g;
      s/\%cardnum2\%/$cardnum2/g;
      s/\%cardnum3\%/$cardnum3/g;
      s/\%cardnum4\%/$cardnum4/g;
      s/\%expmonth\%/$expmonth/g;
      s/\%expyear\%/$expyear/g;
      s/\%cardname\%/$cardname/g;
      s/\%cardaddress\%/$cardaddress/g;
      s/\%cardcity\%/$cardcity/g;
      s/\%cardstate\%/$cardstate/g;
      s/\%cardzip\%/$cardzip/g;
      s/\%email\%/$email/g;
      s/\%phone2\%/$phone2/g;
      s/\%billingmsg\%/$billingmsg/g;
      s/\%ordernum\%/$ordernum/g;
      print;
      if (/<.*form.*action/i){
         print "<input type=\"hidden\" name=user_id value=\"$user_id\">\n";
         if ($mode eq 'test'){
            print "<input type=\"hidden\" name=mode value=\"test\">\n";
         }
      }
   }
}