验证码验证不匹配请再试一次

时间:2017-09-20 08:37:35

标签: php captcha

我的验证码验证问题。以下是newaccount文件中的一些代码。

当我尝试注册时说:

  

“您输入的验证码不匹配,请再试一次。

我有时会让它上班,那是在Chrome上,但它非常不稳定。

<?php session_start();
include ('connect.php');
require_once ('locale/'.$locale.'/'.$locale.'.php');
if(get_magic_quotes_gpc()) {
  $username = stripslashes(htmlspecialchars($_POST['usernames']));
  $password = stripslashes(htmlspecialchars($_POST['passwords']));
  $email = stripslashes(htmlspecialchars($_POST['email']));
  $security = stripslashes(htmlspecialchars($_POST['security']));
} else {
  $username = htmlspecialchars($_POST['usernames']);
  $password = htmlspecialchars($_POST['passwords']);
  $email = htmlspecialchars($_POST['email']);
  $security = htmlspecialchars($_POST['security']);
}
 if(strlen($security) < 4) {
  echo "<span class='infos alert'>$phrase[237] </span>";
  die();
 }
 if((@$_POST['security']) <> @$_SESSION['captcha']) {
  echo "<span class='infos alert'>$phrase[237] </span>";
  session_unset();
  session_destroy();
  die();
  } 
if(strlen($username) < 4) {
  echo "<span class='infos alert'>$phrase[111] </span>";
  die();
}
if(strlen($username) > 20) {
  echo "<span class='infos alert'>$phrase[109] </span>";
  die();
}
if(strlen($password) < 4) {
  echo "<span class='infos alert'>$phrase[112] </span>";
  die();
}
if(strlen($password) > 20) {
  echo "<span class='infos alert'>$phrase[110] </span>";
  die();
}
if(preg_match("/ /",$username)) {
  echo "<span class='infos alert'>$phrase[108]</span>";
  die();
}
if(preg_match("/ /",$password)) {
  echo "<span class='infos alert'>$phrase[108]</span>";
  die();
}
if(preg_match('/\./',$username)) {
  echo "<span class='infos alert'>$phrase[232]</span>";
  die();
}
if(strlen($email) < 5) {
  echo "<span class='infos alert'>$phrase[128]</span>";
  die();
}
if(strlen($email) > 60) {
  echo "<span class='infos alert'>$phrase[127]</span>";
  die();
}
if(!preg_match("/([A-Z0-9_-]+\@[A-Z0-9_-]+\.[a-z.]{2,7}+)+$/i",$email)) {
  echo "<span class='infos alert'>$phrase[129]</span>";
  die();
}

0 个答案:

没有答案