Esempio n. 1
0
 public function checkRecaptchaAction()
 {
     $privatekey = "6LcGEuMSAAAAAAohpDLjBTKW9WhcoIdrnopcBzgY";
     if ($_POST["recaptcha_response_field"]) {
         $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
         if ($resp->is_valid) {
             echo "ok";
             $newsModel = new NewsModel();
             $newsModel->saveComment();
         } else {
             $error = $resp->error;
             echo $error;
         }
     } else {
         echo "error";
     }
 }