我在php中的recaptcha有问题,如果我可以使用reCAPTCHA PHP客户端库制作小代码,那么提交不起作用
<?php
include("db.php");
session_start();
require('recap/autoload.php');
$recaptcha = new \ReCaptcha\ReCaptcha('6LeXoyQUAAAAAIbiIP6-
pAx0_wp1G5MYyN7R7wP0');
if($_SERVER["REQUEST_METHOD"] == "POST" ){
$myusername = mysqli_real_escape_string($db,$_POST['username']);
$mypassword = mysqli_real_escape_string($db,$_POST['password']);
$sql = "SELECT id FROM users WHERE username = '$myusername' and passcode = '$mypassword'";
$result = mysqli_query($db,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
$active = $row['active'];
$resp = $recaptcha->verify($_POST(g-recaptcha-response));
$count = mysqli_num_rows($result);
if($count == 1 && $resp->isSuccess() ) {
// session_register("myusername");
$_SESSION['login_user'] = $myusername;
header("location: welcome.php");
}else {
$error = "Your Login Name or Password is invalid";
}
}
?>