Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]jak w tym skrypcie komentarzy, jak w tym skrypcie komentarzy zrobić
pawlo20
post
Post #1





Grupa: Zarejestrowani
Postów: 112
Pomógł: 0
Dołączył: 31.08.2012

Ostrzeżenie: (40%)
XX---


Witam jak w tym skrypcie pisania komentarzy zrobić zabezpieczenie przed wpisywaniem w komentarz kodu html ?

  1. <?php
  2. if (isset($_POST['submit'])) {
  3. if (isset($_POST['message'])) {
  4. if (isset($_COOKIE['dodano'])) {
  5. echo "Już dodałeś komentarz! Spróbuj za chwilę.<br>";
  6. } else {
  7. $message = str_replace('www','*',$_POST['message']);
  8. $message = ereg_replace("rnrn", "n<P>", $message);
  9. $date=date("H:i d.m.Y");
  10. $message = "<n>".$_POST['name']." </n> <g>".$date."</g><br><br><k>".$message."<HR></k></br>";
  11. $fp = fopen (basename($_SERVER['PHP_SELF']) . ".comment", "a");
  12. fwrite ($fp, $message);
  13. fclose ($fp);
  14. setcookie ("dodano", "{$_POST['name']}", time()+70);
  15. }
  16. }
  17. }
  18. @readfile(basename(($_SERVER['PHP_SELF'] . ".comment")));
  19. ?>
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. <table>
  28.  
  29.  
  30. <form action="komen.php" method="POST" onsubmit="return validateForm(this);">
  31.  
  32. <input type=hidden name=submit value=1>
  33. <br>
  34. <center> <d>Napisz komentarz</d> </center><br>
  35. <tr><td><label>Nick:</label></td><td> <input type=text name="name" required="required"placeholder="nick"><br>
  36. <tr><td><label>E-mail:</label></td><td> <input type="text" name="email" required="required"placeholder="e-mail"class="textarea">
  37. <tr><td><label>Wpisz komentarz:</label></td><td> <textarea name=message required="required"placeholder="treść"rows="7" cols="29"></textarea>
  38. <tr><td><label></label></td><td> <input type="image" name="B1"src="dod.gif"><br>
  39. </form>
  40. </table>
  41. </fieldset
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 22.12.2025 - 16:20