I am new to CGI/PERL and have a problem that was dropped in my lap the
below script was made to show a picture in an htlm page that is called
when you click on the href on the past html page it was working but not
all the time now it is not working at all. I have gone through it several
times and seem to only have a problem at the parsing of the sent gif URL
i may be wrong but that is where I see the problem any ideas?

Tim Zanor

[EMAIL PROTECTED]

P.S.
 this is not my code this is from the original programer and I am finding
and fxing problem through out hte whole set this part is what is keeping
the page off line for over a week now
-------------------------------------------------------------------------
-------------------------------------------------------------------------
------------------------------------------------------------

! /usr/bin/perl

require "stamp_includes.pl"; # locations of various needed .pl and .gif
files
                             # as well as the URL and physical locations
of
                             # various other files and resources

&ReadParse;

&HTML_DEBUG;
&CYA_ERR("my err message");

if ($parms{'image'} eq "") {&CYA_ERR}

&HTML_Head;
&HTML_Meat;
&HTML_Close;

-------------------------------------------------------------------
sub HTML_Head {
  print STDOUT "Content-type: text/html\n\n";
   print STDOUT "<html><body bgcolor=\"#ffffff\">\n";
  print STDOUT "<center>\n";
  print STDOUT "<table border=\"0\" cellpadding=\"10\">\n";
  print STDOUT "   <tr><td><img src=\"",$STAMPICON,"\"
border=\"0\"></td>\n";
  print STDOUT "       <td valign=\"center\"><font
size=\"+2\"><center>\n";
  print STDOUT "                             Product
View</font></center></td>\n";
  print STDOUT "       <td>Return to the <a href=\"";
  if ($parms{'ref'} eq "") {
     print STDOUT $REFERER; }
     else {
     print STDOUT $parms{'ref'}; }

  print STDOUT "\">previous page</a>.</td>\n";
  print STDOUT "   </tr>\n";
  }
-------------------------------------------------------------------
sub HTML_Meat {
  $number=split(/\//,$REFERER);
  (@URLitem)=split(/\//,$REFERER);
   for ( $x=0 ; $x<$number-1 ; $x++ ) {
      $URL .= $URLitem[$x];
     $URL .= "/";
     }
   $URL .= $parms{'image'};
  print STDOUT "<tr>\n";
  print STDOUT " <td colspan=\"3\" align=center><img src=\"",$HTTPROOT"\"
td>\n";
  print STDOUT "</tr>\n";
  }
-------------------------------------------------------------------
sub HTML_Close {
   print STDOUT "<tr><td colspan=\"3\"><center>Return to the <a href=\"";
  if ($parms{'ref'} eq "") {
     print STDOUT $REFERER; }
     else {
      print STDOUT $parms{'ref'}; }

  print STDOUT "\">previous page</a>.</center></td></tr>\n";
  print STDOUT "</table>\n";
  print STDOUT "</center></body></html>\n";
  }
-------------------------------------------------------------------
sub HTML_DEBUG {
  print STDOUT "Content-type: text/html\n\n";
  print STDOUT "<html><body bgcolor=\"#ffffff\">\n";
  print STDOUT "<h1>HTML DEBUGGER</h1><br>\n";
  print STDOUT "<UL>";
  foreach $key ( keys(%parms) ) {
     print STDOUT "  <LI>$key: $parms{$key}\n"; }
  print STDOUT "</UL>\n";
  print STDOUT "<hr><a href=\"";
  if ($parms{'ref'} eq "") {
     print STDOUT "$REFERER"; }
     else {
     print STDOUT "$parms{'ref'}"; }
  print STDOUT "\"><img src=\"",$CONTINUE,"\" border=\"0\"></a>\n";
  print STDOUT "</body></html>";
  exit;
  }
-------------------------------------------------------------------
 sub CYA_ERR {
 print <<EndOfHTML;
<html><head><title>SORRY PAGE</title></head>
<body>
<td valign=\"center\"><font size=\"+2\"><center>
<h2>We Are Sorry but our pictures are teporarly down</h2>


<td valign=\"center\"><font size=\"+2\"><center>

          <td>Return to the <a href=\
   if ($parms{'ref'} eq "") {print STDOUT $REFERER; }
      else {print STDOUT $parms{'ref'}

   print >previous page</a>.</td>

</body></html>

EndOfHTML
}
  local ($msg) = @_;
 print STDOUT "Content-type: text/html\n\n";
print STDOUT "<html>\n";
  print STDOUT "<h1>An error has occurred.</h1><br>\n";
  print STDOUT "Please contact the network administrator and give him\n";
  print STDOUT "the following error message information:<p>";
  print STDOUT "<pre>Hostname: $HOSTID \n";
  print STDOUT "$msg\n</pre>\n";

  print STDOUT "<hr><a href=\"";
  if ($parms{'ref'} eq "") {
     print STDOUT "$REFERER"; }
     else {
     print STDOUT "$parms{'ref'}"; }
  print STDOUT "\"><img src=\"",$CONTINUE,"\" border=\"0\"></a>\n";
  print STDOUT "</body></html>";
  exit;
   }

-------------------------------------------------------------------
sub ReadParse {

  Read in text
 if ($ENV{'REQUEST_METHOD'} eq "GET") {
    $lqs = $ENV{'QUERY_STRING'};
       } elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
      read(STDIN,$lqs,$ENV{'CONTENT_LENGTH'});
    }

 (@localparms) = split(/&/,$lqs);
 $nparms = scalar(@localparms);
 foreach $p (@localparms) {
    ($pname,$pvalue) = split(/=/, $p);
    $pvalue =~ s/\+/ /g;
    $pvalue =~ s/%([0-9a-fA-F][0-9a-fA-F])/sprintf("%c",hex($1))/eg;
    if ($pname eq "desc") {
      $parms{$pname} = join(",",$parms{$pname},$pvalue);
       } else {
       $parms{$pname} = $pvalue; }
    }
 $parms{"desc"} =~ s/^,//;        # remove leading comma if it exists
 $REFERER=$parms{"ref"};
 if ($REFERER eq "") {
    $REFERER=$ENV{'HTTP_REFERER'};
    if ($REFERER eq "")
         { $REFERER="http://www.stampprof.com";;  }
    }
}
-------------------------------------------------------------------

________________________________________________________________
The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to