Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Problem z gotowym skryptem
obelix94
post
Post #1





Grupa: Nieautoryzowani
Postów: 141
Pomógł: 0
Dołączył: 30.09.2008
Skąd: Gdańsk

Ostrzeżenie: (20%)
X----


Sciągnąłem sobie jeden skrypcik i chciałbym go zrozumieć, oraz przerobic. Niestety jedno wynika z drugiego, a ja nie umiem tego pierwszego. Krótko mówiąć, proszę was o objaśnienie mi poniższego skrypciku.

  1. <?
  2. /*
  3.  
  4. annotate.php3 
  5.  
  6. This is a module that can be placed on any php3 page to allow users to add
  7. their comments. The comments are stored in a file in the current directory,
  8. whose name is constructed by adding ".comment" to the calling page's name,
  9. and merged into the calling page dynamically. (The calling page is not
  10. modified.)
  11.  
  12. I wrote this because I wanted a simple way to add this functionality to my
  13. pages without requiring that mySQL be available.
  14.  
  15. In the message input, blank lines are converted to paragraph tags. No other
  16. conversions are applied. If you don't want your users to be able to input
  17. html, uncomment the "strip_tags" line.
  18.  
  19. Note that the directory must be writable by the web server.
  20.  
  21. Put this module in some convenient location and then embed it in your pages
  22. like so:
  23.  
  24. require("/some/full/path/annotate.php3");
  25. or, relative to the docroot:
  26. require($DOCUMENT_ROOT . "/relativepath/php3");
  27.  
  28. Steve Yelvington <steve@yelvington.com>
  29.  
  30. */
  31. if ($message)
  32.  {
  33.  /* uncomment the next two lines to strip out html from input */
  34.  /* $name = strip_tags($name); */
  35.  /* $message = strip_tags($message); */
  36.  $message = ereg_replace("r\nr\n", "\n<P>", $message);
  37.  $date = date("l, F j Y, h:i a");
  38.  $message = "<B>$name </B> -- $date<P> $message <BR><HR>";
  39.  $fp = fopen (basename($PHP_SELF) . ".comment", "a");
  40.  fwrite ($fp, $message);
  41.  fclose ($fp);
  42.  }
  43. @readfile(basename(($PHP_SELF . ".comment")));
  44. ?>
  45. <FORM method="post">
  46. <b>Your name:</b><BR><INPUT name="name" type="text" size="55"><BR>
  47. <b>Your comment:</b><BR><TEXTAREA name="message" rows=10 cols=55 wrap=virtual>
  48. </TEXTAREA><BR>
  49. <INPUT name="submit" type="submit" value="Post your comments">
  50. </FORM>
  51.  
  52. </body>
  53. </html>


--------------------
Zawieszony w pisaniu przez @mike - pisze na PW. <?php echo !$lubie.'moderatorow' ?>
Jak to czytasz, to współczuj mi. Przebolewam za swe grzechy...
Współczujcie...
Gdzie to współczucie?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 09:00