这个表单最初使用的是reCAPTCHAv1,但是我删除了相关的代码。我收集用户注册信息发布到mysql数据库,但提交按钮只刷新页面,并没有导致进一步的消息,有一个确认电子邮件遵循。这些文件是可访问的,功能强大,但表单本身和提交不起作用。
我已经尝试将recaptcha v2作为替代品,并成功地这样做了,但表单仍然没有提交。从那以后我就把它拿走了。此外,我还删除了一些字段,以查看terms和conditions的复选框是否是问题所在,因为如果未选中,它不会抛出与其他字段不同的错误,但这也不起作用。我已经回顾了之前关于php表单提交问题的问题,我发现按钮类型与notsubmit中的不正确,但它是正确的类型。数据库已确认连接,这是对'config.php'的调用
表单的php代码:
$data['PageName']='SIGN UP FOR YOUR FREE ACCOUNT TODAY';
$data['PageFile']='signup';
$data['PageTitle'] = 'Sign Up - GPW';
include('../config.php');
require_once('recaptchalib.php');
// Get a key from https://www.google.com/recaptcha/admin/create
$publickey = "6Ld3c-YSAAAAAIIdQocSje_bq1a7Sti3QymRM5hw";
$privatekey = "6Ld3c-YSAAAAAJqrQBNAR_Qb40Mh4BveQ_q8bjv0";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
if($_SESSION['login']){
header("Location:{$data['Host']}/members/index.php");
echo('Logged In');
exit;
}
if($post['action']=='go')optimize('common');
if($post['send']){
if(!$post['newuser']){
$data['Error']='Your username can not be empty.';
}elseif(verify_username($post['newuser'])){
$data['Error']='For your username you can use only next letters [A..Z, a..z, 0..9].';
}elseif(!$post['newpass']){
$data['Error']='Your password can not be empty.';
}elseif(strlen($post['newpass'])<$data['PassLen']){
$data['Error']="Your password must be at least {$data['PassLen']} characters long.";
}elseif($post['newpass']!=$post['cfmpass']){
$data['Error']='Your password and confirm should be not different.';
}elseif($post['newuser']==$post['newpass']){
$data['Error']='Your password can not be same as your username.';
}elseif(!$post['newques']){
$data['Error']='Please enter a valid security question.';
}elseif(!$post['newansw']){
$data['Error']='Please enter a valid security answer.';
}elseif(!$post['newmail']||verify_email($post['newmail'])){
$data['Error']='Please enter your valid e-mail address.';
}elseif($data['UseExtRegForm']&&!$post['newfname']){
$data['Error']='Please enter your first name.';
}elseif($data['UseExtRegForm']&&!$post['newlname']){
$data['Error']='Please enter your last name.';
}elseif($data['UseExtRegForm']&&!$post['newaddress']){
$data['Error']='Please enter your address.';
}elseif($data['UseExtRegForm']&&!$post['newcity']){
$data['Error']='Please enter your city.';
}elseif($data['UseExtRegForm']&&!$post['newcountry']){
$data['Error']='Please enter your country.';
}elseif($data['UseExtRegForm']&&!$post['newzip']){
$data['Error']='Please enter your postal code.';
}elseif($data['UseExtRegForm']&&!$post['newphone']){
$data['Error']='Please enter your telephone number.';
}elseif($post['terms']!='on'){
$data['Error']='Please read our Terms and Conditions before signup.';
}elseif(!is_user_available($post['newuser'])){
$data['Error']='Sorry but this username already taken.';
}elseif(!is_mail_available($post['newmail'])){
$data['Error']='Sorry but this e-mail address already taken.';
}else{
if (isset($_POST["recaptcha_response_field"])) {
$resp = recaptcha_check_answer($privatekey,$_SERVER["REMOTE_ADDR"],$_POST["recaptcha_challenge_field"],$_POST["recaptcha_response_field"]);
//print_r($_SERVER["REMOTE_ADDR"]);
if ($resp->is_valid) {
create_confirmation(
$post['newuser'],
$post['newpass'],
$post['newques'],
$post['newansw'],
$post['newmail'],
$post['newfname'],
$post['newlname'],
$post['newcompany'],
$post['newregnum'],
$post['newdrvnum'],
$post['newaddress'],
$post['newcity'],
$post['newcountry'],
$post['newstate'],
$post['newzip'],
$post['newphone'],
$post['newfax'],
get_member_id($_SESSION['sponsor'])
);
unset($_SESSION['turing']);
$data['PostSent']=true;
}
} else {
$error = $resp->error;
}
}
}else{
if($data['UseTuringNumber'])$_SESSION['turing']=gencode();
}
display('members');
?>
1条答案
按热度按时间bvpmtnay1#
缺少引号