home *** CD-ROM | disk | FTP | other *** search
/ CGI How-To / CGI HOW-TO.iso / chap8 / 8_2 / get_info.cgi < prev    next >
Encoding:
Text File  |  1996-06-15  |  1.7 KB  |  83 lines

  1. #!/usr/local/bin/perl
  2.  
  3. unshift (@INC, "/usr/local/etc/httpd/cgi-bin/Library");
  4. require "cgi-lib.pl";
  5. &ReadParse(*MYDATA);
  6.  
  7.  
  8. $customer_service_email = "selena\@eff.org";
  9. $mail_program = "mail";
  10. $get_info_who = "access.temp";
  11.  
  12.  
  13. if ($MYDATA{'type'} eq "order")
  14.   {
  15.  
  16.  
  17. open (NOTE, ">$get_info_who") || &open_error($get_info_who);
  18.  
  19. print NOTE "Someone placed an order!\n\n";
  20. print NOTE "    Name:    $MYDATA{'name'} \n";
  21. print NOTE "    Product: $MYDATA{'product'} \n";
  22.  
  23. close (NOTE);
  24.  
  25.  
  26. system ("$mail_program -s Order  $customer_service_email< $get_info_who");
  27.  
  28.  
  29. print "Content-type: text/html\n\n";
  30. &HTML_response(order);
  31.  
  32. } # This is the end of the if  test for ordering.
  33.  
  34.  
  35. if ($MYDATA{'type'} eq "comment")
  36.   {
  37.   open (NOTE, ">$get_info_who") || &open_error($get_info_who);
  38.  
  39.   print NOTE "Someone sent in a comment!\n\n";
  40.   print NOTE "    Name:    $MYDATA{'name'} \n";
  41.   print NOTE "    Comment: $MYDATA{'comment'} \n";
  42.  
  43.   close (NOTE);
  44.  
  45.  
  46. system ("$mail_program -s Comment  $customer_service_email< $get_info_who");
  47.  
  48.   print "Content-type: text/html\n\n";
  49.   &HTML_response(comment);
  50.  } # This is the end of the if  test for comments.
  51.  
  52.  
  53.   sub open_error
  54.     {
  55.  
  56.  
  57.     local ($filename) = @_;
  58.  
  59.  
  60.     print "I am really sorry, but for some reason I was unable to open
  61.     <P>$filename<P>  Would you please make sure that the filename is
  62.     correctly defined in define_variables.pl, actually exists, and has 
  63.     the right permissions relative to the web browser.  Thanks!";
  64.     die;
  65.     }
  66.  
  67.  
  68. sub HTML_response
  69.  {
  70.  local ($type) = @_;
  71.  print "<HTML><HEAD>";
  72.  print "<TITLE>Feedback Response</TITLE></HEAD><BODY> \n";
  73.  print "<H2><CENTER>Thanks for your $type, someone will get back to 
  74.          you asap</CENTER></H2>";
  75.  
  76.  
  77.  unlink ($get_info_who);
  78.  
  79.  
  80. die;  
  81.  }
  82.  
  83.