Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Anty-spam w formularzu kontaktowym
Nevildevil
post
Post #1





Grupa: Zarejestrowani
Postów: 13
Pomógł: 0
Dołączył: 12.11.2011

Ostrzeżenie: (0%)
-----


Hej. Mam do Was prośbę. Czy mógłby ktoś przerobić ten skrypt, aby każdy użytkownik mógł wysłać wiadomość raz na jakiś czas, powiedzmy 5 minut? Byłbym bardzo wdzięczny (IMG:style_emoticons/default/smile.gif)

  1.  
  2. <?php
  3. if (count($_POST))
  4. {
  5. ////////// USTAWIENIA //////////
  6. $email = 'hubosek98@gmail.com'; // Twój e-mail
  7. $subject = 'Film z lola'; // Temat maila
  8. $message = '<img src="thanks.png"><br><br><font color="yellow"><h3>Dziękuję za wysłanie filmu. W ciągu 24h zweryfikuję Twój film i wstawię na stronę.</font></h3>'; // Komunikat
  9. $error = 'Wystąpił błąd podczas wysyłania filmu.'; // Komunikat błędu
  10. $charset = 'iso-8859-2'; // Kodowanie
  11. //////////////////////////////
  12.  
  13. $head =
  14. "MIME-Version: 1.0\r\n" .
  15. "Content-Type: text/plain; charset=$charset\r\n" .
  16. "Content-Transfer-Encoding: 8bit";
  17. $body = '';
  18. foreach ($_POST as $name => $value)
  19. {
  20. if (is_array($value))
  21. {
  22. for ($i = 0; $i < count($value); $i++)
  23. {
  24. $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
  25. }
  26. }
  27. else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
  28. }
  29. echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
  30. }
  31. else
  32. {
  33. ?>
  34. <form action="?" method="post">
  35. <table>
  36. <tr>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td><font color="yellow">Twój email:</font></td>
  41. <td><input type="text" size="25" name="Email wysyłającego" /></td>
  42. </tr>
  43. <tr>
  44. <td><font color="yellow">Tytuł filmu</font></td>
  45. <td><input type="text" size="25" name="Tytuł filmu" /></td>
  46. </tr>
  47. <tr>
  48. <td><font color="yellow">Autor filmu:</font></td>
  49. <td><input type="password" size="25" name="Autor filmu" /></td>
  50. </tr>
  51. <tr>
  52. <td colspan="2">&nbsp;</td>
  53. </tr>
  54.  
  55. </table>
  56. </div>
  57. <br />
  58. <table>
  59. <tr>
  60. <td><font color="yellow">Opis filmu:</font></td>
  61. <td><textarea name="Opis filmu" cols="46" rows="6"></textarea></td>
  62. </tr>
  63. </table>
  64. <br /><br />
  65. <table align="center">
  66. <tr>
  67. <td><button type="reset">Zresetuj</button></td>
  68. <td><button type="submit">Dodaj</button></td>
  69. </tr>
  70. </table>
  71. </form>
  72. <?php
  73. }
  74. ?>
  75.  
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.08.2025 - 17:23