home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / guestbook-de.cgi.new < prev    next >
Encoding:
Text File  |  2004-04-13  |  2.7 KB  |  97 lines

  1. #!\xampp\perl\bin\perl.exe
  2.  
  3. #    Copyright (C) 2002/2003 Kai Seidler, oswald@apachefriends.org
  4. #
  5. #    This program is free software; you can redistribute it and/or modify
  6. #    it under the terms of the GNU General Public License as published by
  7. #    the Free Software Foundation; either version 2 of the License, or
  8. #    (at your option) any later version.
  9. #
  10. #    This program is distributed in the hope that it will be useful,
  11. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. #    GNU General Public License for more details.
  14. #
  15. #    You should have received a copy of the GNU General Public License
  16. #    along with this program; if not, write to the Free Software
  17. #    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.  
  20. use CGI;
  21.  
  22. $form=new CGI;
  23.  
  24. $f_name=$form->param("f_name");
  25. $f_email=$form->param("f_email");
  26. $f_text=$form->param("f_text");
  27.  
  28. print "Content-Type: text/html\n\n";
  29.  
  30. if($f_name)
  31. {
  32.     open (FILE, ">>guestbook.dat") or die ("Cannot open guestbook file");
  33.     print FILE localtime()."\n";
  34.     print FILE "$f_name\n";
  35.     print FILE "$f_email\n";
  36.     print FILE "$f_text\n";
  37.     print FILE "╖\n";
  38.     close(FILE);
  39. }
  40.  
  41. print '<html>';
  42. print '<head>';
  43. print '<meta name="author" content="Kai Oswald Seidler">';
  44. print '<link href="../styles.css" rel="stylesheet" type="text/css">';
  45. print '</head>';
  46.  
  47. print '<body>';
  48. print ' <p>';
  49.  
  50. print "<h1>GΣstebuch (Beispiel fⁿr Perl)</h1>\n";
  51.  
  52. print "Ein ganz klassisches GΣstebuch: von oben nach unten zeitlich die BeitrΣge!";
  53.  
  54. open (FILE, "<guestbook.dat") or die ("Cannot open guestbook file");
  55.  
  56. while(!eof(FILE)){
  57.     chomp($date=<FILE>);
  58.     chomp($name=<FILE>);
  59.     chomp($email=<FILE>);
  60.  
  61.     print "<p class=small>$date";
  62.     print "<table border=0 cellpadding=4 cellspacing=1>";    
  63.     print "<tr><td class=h>";
  64.     print "<img src=img/blank.gif width=250 height=1><br>";
  65.     print "Name: $name";
  66.     print "</td><td class=h>";
  67.     print "<img src=img/blank.gif width=250 height=1><br>";
  68.     print "E-Mail: $email";
  69.     print "</td></tr>";
  70.     print "<tr><td class=d colspan=2>";
  71.     while(1==1){
  72.         chomp($line=<FILE>);
  73.         if($line eq '╖') {
  74.             last;
  75.         }
  76.         print "$line<br>";
  77.     }
  78.     print "</td></tr>";
  79.     print "</table>";    
  80. close (FILE);
  81.  
  82. print "<p>Eintrag hinzufⁿgen:";
  83.  
  84. print "<form action=guestbook-de.cgi method=get>";
  85. print "<table border=0 cellpadding=0 cellspacing=0>";
  86. print "<tr><td>Name:</td><td><input type=text size=30 name=f_name></td></tr>";
  87. print "<tr><td>E-Mail:</td><td> <input type=text size=30 name=f_email></td></tr>";
  88. print "<tr><td>Text:</td><td> <textarea type=text rows=3 cols=30 name=f_text></textarea></td></tr>";
  89. print "<tr><td></td><td><input type=submit value=\"SCHREIBEN\"></td></tr>";
  90. print "</table>";
  91. print "</form>";
  92.  
  93.  
  94. print "</body>";
  95. print "</html>";
  96.