Moze i troche smieszne a moze i żałosne nie dziala mi kod recaptcha ciagle pisze nieprawidlowy kod


  1. <?php
  2. include("subheader.php");
  3. require_once('recaptchalib.php');
  4. // Get a key from <a href="https://www.google.com/recaptcha/admin/create" target="_blank">https://www.google.com/recaptcha/admin/create</a>
  5. $publickey = "6LenCt0SAAAAAEJHvzbIB6-a07TWz1cbEDE3A-lt";
  6. $privatekey = "6LenCt0SAAAAAOmpaDqTbGRDnOPTaTg337ES8sGr";
  7. # the response from reCAPTCHA
  8. $resp = null;
  9.  
  10. if(isset($_POST["konto"])){
  11. if ($_POST['konto'] !== "" && $_POST['password'] !== "" && $_POST['password2'] !== "" && $_POST['email'] !== ""&& $_POST["recaptcha_response_field"] !== ""){
  12. $resp = recaptcha_check_answer ($privatekey,
  13. $_SERVER["REMOTE_ADDR"],
  14. $_POST["recaptcha_challenge_field"],
  15. $_POST["recaptcha_response_field"]);
  16.  
  17. if($_SESSION['recaptcha_response_field'] == $_POST['recaptcha_response_field'] && $resp) {
  18. if ($_POST['password']==$_POST['password2']){
  19. $konto = mysql_real_escape_string (strtolower(trim($_POST['konto'])));
  20. $email = mysql_real_escape_string (trim($_POST['email']));
  21. $password = md5(mysql_real_escape_string (trim($_POST['password'])));
  22. $ile =mysql_query("SELECT * FROM ".$pre."user WHERE user_login = '$konto'");
  23. $ile = mysql_num_rows($ile);
  24. if ($ile==0){
  25. $zapytanie="INSERT INTO ".$pre."user (user_login,user_haslo,user_email,user_data_r) VALUES('$konto','$password','$email',NOW())";
  26. mysql_query($zapytanie) or die("Wystąpił błąd");
  27. $smarty->assign("regok","1");
  28. }else{
  29. $smarty->assign("login","1");
  30. }
  31. }
  32. else
  33. $smarty->assign("hasla","1");
  34. }else{
  35. $smarty->assign("token","1");
  36. }
  37. }else{
  38. $smarty->assign("pola","1");
  39. }
  40. }else{
  41.  
  42.  
  43. }
  44. $smarty->assign("token_img",recaptcha_get_html($publickey));
  45. $smarty->assign("idtoken",$idtoken);
  46. $smarty->display($ust['templates'].'/register.tpl');
  47. ?>