此表单最初使用reCAPTCHA v1,但我已删除了相关代码。 我正在收集用户注册信息以发布到MySQL数据库,但是“提交”按钮仅刷新页面,并且不会进一步导致出现确认电子邮件的消息。这些文件可以访问并且可以使用,但是表单本身和提交均不起作用。
我尝试将reCAPTCHA v2包括在内,并成功完成了该工作,但该表格仍未提交。此后,我将其删除。此外,我删除了字段以查看“条款和条件”复选框是否是问题所在,因为如果不选中它,不会像其他字段一样引发错误,但这也不起作用。我查看了有关PHP表单提交问题的先前问题,发现所有按钮类型不正确,如未提交,但它是正确的类型。确认数据库已连接,名为“ 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');
?>
答案 0 :(得分:0)
Controller.foo()
缺少引号
type=submit name=send