Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP][HTML]ReCaptcha i problem
elewator
post
Post #1





Grupa: Zarejestrowani
Postów: 63
Pomógł: 1
Dołączył: 30.07.2008
Skąd: Ustka

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


Wiec. mam taki sobie skrypcik z recaptcha:
  1. <html>
  2. <head>
  3.  
  4.  
  5. <?php include('includes/head.php'); ?>
  6. </head>
  7. <body>
  8. <?php include('includes/header.php'); ?>    
  9.    <form action="add2.php" method="post">    
  10.    <?php
  11.  
  12. require_once('recaptchalib.php');
  13. $publickey = "xxx";
  14. $privatekey = "xxx";
  15. # the response from reCAPTCHA
  16. $resp = null;
  17. # the error code from reCAPTCHA, if any
  18. $error = null;
  19.  
  20. # are we submitting the page?
  21. if ($_POST["submit"]) {
  22.  $resp = recaptcha_check_answer ($privatekey,
  23.                                  $_SERVER["REMOTE_ADDR"],
  24.                                  $_POST["recaptcha_challenge_field"],
  25.                                  $_POST["recaptcha_response_field"]);
  26.  
  27. if (!$resp->is_valid) {
  28.    
  29.   die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
  30.        "(reCAPTCHA said: " . $resp->error . ")");
  31. } else {
  32.   // Your code here to handle a successful verification
  33. }
  34.  
  35. }
  36.  
  37.  
  38. echo recaptcha_get_html($publickey, $error);
  39. ?>
  40. IP Servera:<input type="text" name="ip" /><br />
  41. Wybierz typ serwera:<select name="typ">
  42. <option value="halflife">Steam</option>
  43. <option value="halflifewon">No-Steam</option>
  44.   <input type="submit" value="Dodaj!" />
  45. </form>
  46. <?php include('includes/sidebar.php'); ?>
  47. <?php include('includes/footer.php'); ?>
  48. </html>
  49.  
  50. </select><br>

Wszystko jest ladnie, pieknie lecz nawet jak wpisze zle captche to formularz i tak leci... Jak temu zaradzic?
Powód edycji: [erix] przeniosłem
Go to the top of the page
+Quote Post
in5ane
post
Post #2





Grupa: Zarejestrowani
Postów: 1 335
Pomógł: 34
Dołączył: 9.11.2005
Skąd: Wrocław

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


Myślę, że masz coś z instrukcją warunkową, która ma za zadanie sprawdzać. Nie mam czasu tego analizować, dlatego pomyśl jeszcze sam.

@edit: pamiętaj, że to co przychodzi z formularza musi się równać temu co zostało wygenerowane przez skrypt, wtedy dopiero instrukcja warunkowa może przepuścić skrypt dalej.

Ten post edytował in5ane 21.06.2009, 08:15:08
Go to the top of the page
+Quote Post
elewator
post
Post #3





Grupa: Zarejestrowani
Postów: 63
Pomógł: 1
Dołączył: 30.07.2008
Skąd: Ustka

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


myslalem, myslalem i nic...
Go to the top of the page
+Quote Post

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: 24.08.2025 - 15:08