home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Internet / WWW / Perl_WWW_Utilities / weblog1.1 / visitor.pl < prev    next >
Encoding:
Perl Script  |  1995-06-25  |  1.7 KB  |  61 lines

  1. #!/usr/bin/perl -U
  2. # Perl script by Matt Mankins December 11 1994
  3. # Modified May 95 burt rosenberg: to put newest entries first. 
  4.  
  5. $wdir = "/export/httpd/htdocs/web/visitorlog/" ;
  6. $ipath = "/images";
  7. $quote='"';
  8.  
  9. print "Content-type: text/html\n\n";
  10.  
  11. if ($ENV{"WWW_name"}) 
  12.  {
  13. print $wdir . "visitors.html";
  14.    open (V, $wdir . "visitors.html") || die print "No can do on V."; 
  15.    open (W, ">" . $wdir . "visitors.tmp") || die print "No can do on W."; 
  16.    while (<V>) 
  17.     {
  18.      print W $_ ;
  19.      /Top-of-book/ && last ;
  20.     }
  21.  
  22. #   $DATE = localtime(time);
  23.  
  24.    print W "<B>",`date`,"</B><P>\n";
  25.    print W "<I>Name</I>   : ",$ENV{"WWW_name"},"<P>\n";
  26.   
  27.    if ($ENV{"WWW_email"}) 
  28.     {
  29.      print W "<I>Email</I>  : ",$ENV{"WWW_email"},"<P>\n";
  30.     }
  31.    if ($ENV{"WWW_comment"}) 
  32.     {
  33.      print W "<I>Comment</I>: ",$ENV{"WWW_comment"},"<P>";
  34.     }
  35.    print W "<hr>\n";
  36.    while (<V>) {
  37.       print W $_ ;
  38.    }
  39.    close V;
  40.    close W;
  41.    rename ( $wdir . "/visitors.tmp", $wdir . "/visitors.html") ;
  42.    chmod 0664, $wdir . "/visitors.html" ;
  43.    
  44.    print "<TITLE>Visitor's Book Signed!</TITLE>";
  45.    print "<H2>Visitor's Book Signed!</H2>\n";
  46.    print "<IMG SRC=",$quote,"$ipath/visitors.gif",$quote,"><hr>\n";
  47.    print "<B>",`date`,"</B><P>\n";
  48.    print "<I>Name</I>   : ",$ENV{"WWW_name"},"<P>\n";
  49.    print "<I>Email</I>  : ",$ENV{"WWW_email"},"<P>\n";
  50.    print "<I>Comment</I>: ",$ENV{"WWW_comment"},"<P>\n";
  51.    print "<hr><a href=",$quote,"/web/visitorlog/visitors.html",$quote,">View</a>\n";
  52.    print "visitor's book\n";
  53.  }
  54. else 
  55.  {
  56.    print "<TITLE>No Name Added!</TITLE>\n";
  57.    print "<H2>No Name Added!</H2>\n";
  58.    print "<B>You must supply a name to be added to the visitor's book.</B>";
  59.    print '<P><a href="/web/book.htm">Try again.</a>';
  60.  }
  61.