-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaptcha.php
More file actions
executable file
·31 lines (28 loc) · 848 Bytes
/
captcha.php
File metadata and controls
executable file
·31 lines (28 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
//$recaptcha = $_POST('g-recaptcha-response');
//
// if(!$recaptcha){
// $secret ='6Ld6hB0UAAAAABPnKhEohOkSSzGekbEZmESA90Wz';
// $ip = $_SERVER['REMOTE_ADDR'];
// $sicaptcha = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$recaptcha&remoteip=$ip");
// $respuesta = json_decode($sicaptcha, true);
//
// if($respuesta['success']){
// return $respuesta;
// }else{
// return $respuesta;
// }
// }else {
// return $respuesta;
// }
require_once('recaptchalib.php');
$privatekey = "6Ld6hB0UAAAAABPnKhEohOkSSzGekbEZmESA90Wz";
$resp = recaptcha_check_answer ($privatekey,$_SERVER["REMOTE_ADDR"],$_POST["recaptcha_challenge_field"],$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
//ERROR EN EL CAPTCHA
echo 0;
}else{
//CAPTCHA CORRECTO
echo 1;
}
?>