Witam serdecznie. Mam na stronie poniższy kod. Zlecę przeróbkę tak aby zabezpieczyć ankietę przed wielokrotnym wypełnianiem za pomocą cookies lub za pomocą ip..

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.  
  5. <head>
  6.  
  7. <title>Tytuł</title>
  8.  
  9. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" />
  10.  
  11. <link rel="stylesheet" type="text/css" href="style.css" />
  12.  
  13. </head>
  14.  
  15. <body>
  16.  
  17. <?php
  18.  
  19. if (count($_POST))
  20.  
  21. {
  22.  
  23. ////////// USTAWIENIA //////////
  24.  
  25. $email = 'xxx@onet.pl'; // Adres e-mail adresata
  26.  
  27. $subject = 'Pytanie1'; // Temat listu
  28.  
  29. $message = 'Twoje odpowiedzi zostały przesłane!'; // Komunikat
  30.  
  31. $error = 'Wystąpił błąd! Spróbuj jeszcze raz!'; // Komunikat błędu
  32.  
  33. $charset = 'iso-8859-2'; // Strona kodowa
  34.  
  35. //////////////////////////////
  36.  
  37. $head =
  38.  
  39. "MIME-Version: 1.0\r\n" .
  40.  
  41. "Content-Type: text/plain; charset=$charset\r\n" .
  42.  
  43. "Content-Transfer-Encoding: 8bit";
  44.  
  45. $body = '';
  46.  
  47. foreach ($_POST as $name => $value)
  48.  
  49. {
  50.  
  51. if (is_array($value))
  52.  
  53. {
  54.  
  55. for ($i = 0; $i < count($value); $i++)
  56.  
  57. {
  58.  
  59. $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value[$i]) : $value[$i]) . "\r\n";
  60.  
  61. }
  62.  
  63. }
  64.  
  65. else $body .= "$name=" . (get_magic_quotes_gpc() ? stripslashes($value) : $value) . "\r\n";
  66.  
  67. }
  68.  
  69. echo mail($email, "=?$charset?B?" . base64_encode($subject) . "?=", $body, $head) ? $message : $error;
  70.  
  71. }
  72.  
  73. else
  74.  
  75. {
  76.  
  77. ?>
  78.  
  79. <form action="?" method="post">
  80. <input name="Imię" />Podaj swój nick<br />
  81.  
  82. </br></br>
  83.  
  84. <!-- Pole typu RADIO -->
  85. <p>Pytanie A</p>
  86. <input type="radio" name="pytanieA" value="0" />0
  87. <input type="radio" name="pytanieA" value="1" />1
  88. </br></br>
  89.  
  90. <!-- Pole typu RADIO -->
  91. <p>Pytanie B:</p>
  92. <input type="radio" name="pytanieB" value="0" />0
  93. <input type="radio" name="pytanieB" value="1" />1
  94. <br /><br />
  95.  
  96. <!-- Przycisk WYŚLIJ -->
  97.  
  98. <input type="submit" value="Wyślij wynik" />
  99.  
  100. </form>
  101.  
  102. <?php
  103.  
  104. }
  105.  
  106. ?>
  107.  
  108. </div>
  109.  
  110. <!-- End Right Column -->
  111.  
  112. <div class="clear"></div>
  113.  
  114. <!-- End Wrapper -->
  115.  
  116. </body>
  117.  
  118. </html>