Advertisement
Syntafin

blog.php Kommentarfeld

Mar 22nd, 2012
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.62 KB | None | 0 0
  1. <form action="?p=blog&amp;mode=view&amp;id=<?php echo $kid ?>&amp;action=commentpost" method="post" id="commentform">
  2. <label for="form-name">Name (erforderlich)</label><br />
  3. <input name="form-name" id="name" type="text" required>
  4. <label for="form-email"><br />Email (erfordlich)</label><br />
  5. <input name="form-email" id="email" type="email" required>
  6. <label for="form-url"><br />Homepage</label><br />
  7. <input name="form-url" id="url" type="url">
  8. <label for="form-comment" class="middle"><br />Dein Kommentar</label><br />
  9. <textarea name="form-comment" id="comment"></textarea>
  10. <br />Spamschutz:
  11. <?php
  12.  
  13. require_once('core/include/recaptchalib.php');
  14.  
  15. // Get a key from https://www.google.com/recaptcha/admin/create
  16. $publickey = "6Lfpvs4SAAAAANMGgRw6HQUBYp1Bc89-IO6TB-fb";
  17. $privatekey = "6Lfpvs4SAAAAAGH7bNbO-ItVzjlWbuouO-JfuGGk";
  18.  
  19. # the response from reCAPTCHA
  20. $resp = null;
  21. # the error code from reCAPTCHA, if any
  22. $error = null;
  23.  
  24. # was there a reCAPTCHA response?
  25. if (!empty($_POST["recaptcha_response_field"])) {
  26.         $resp = recaptcha_check_answer ($privatekey,
  27.                                         $_SERVER["REMOTE_ADDR"],
  28.                                         $_POST["recaptcha_challenge_field"],
  29.                                         $_POST["recaptcha_response_field"]);
  30.  
  31.         if ($resp->is_valid) {
  32.                 echo "You got it!";
  33.         } else {
  34.                 # set the error code so that we can display it
  35.                $error = $resp->error;
  36.         }
  37. }
  38. echo recaptcha_get_html($publickey, $error);
  39. ?>
  40. <br />
  41. <input class="button" type="submit" value="Kommentar eintragen" />
  42. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement