您好我需要一些PHP的帮助。我正在尝试在html中创建一个表单并使用php来验证密码输入是否为密码2和电子邮件...
我已经构建了它但是我现在在输入验证器的末尾尝试put(else)。
我总是得到错误:解析错误:语法错误,意外'否则'第82行的C:\ xampp \ htdocs \ main \ register.php中的(T_ELSE)
<?PHP
session_start();
$something=$_POST["something"];
$something=$_POST["something"];
$something=$_POST["something"];
$something=$_POST["something"];
$something=$_POST["something"];
$something=$_POST["something"];
if($serverSettings['register_on'] && (!isset($_SESSION['something']) && !checkInt($_SESSION['something']) && !$_SESSION['something']>=0)) {
if(isset($_POST['submit']) && $_POST['submit'] == 'Registar') {
if((checkAnum($_POST['something']) && strlen($_POST['something'])>=4 && strlen($_POST['something'])<=16) &&
checkAnum($_POST['password']) && strlen($_POST['password'])>=8 && strlen($_POST['password2'])<=16 && !empty($_POST['password2']) &&
(checkName($_POST['something']) && strlen($_POST['something'])>=3 && strlen($_POST['something'])<=20) && $_POST['password']==$_POST['password2'] &&
checkMail($_POST['email']) && strlen($_POST['email'])<=40 && $_POST['email']==$_POST['email2'] &&
(checkAnum($_POST['something']) && strlen($_POST['something'])>=3 && strlen($_POST['something'])<=16) &&
(checkAnum($_POST['something']) && strlen($_POST['something'])==7)) {
require_once("***/configfilee.php");
mysql_select_db("ahsdsdbdi2");
$exec="select * from account where login='$something'";
$result=mysql_query($exec);
$rs=mysql_fetch_object($result);
if($rs){
echo "<center><b><font color='#ff0000'>Registo falhou:</font> This account already exists.</b></center>";
}
else {
$exec="insert into account (something,something,something,something,something,something) values('$something',something('$something'),'$something','$something','$something','$something')";
mysql_query("set names big5 ");
mysql_query("set CHARACTER big5 ");
mysql_query($exec);
echo "<center>
<h1><u>Registration completed successfully.</u></h1><br />";exit;
}
}`enter code here`
HERE IS MY PROBLEM-> else {
echo "<p>Something is wrong!</p>";
}
}
?>
如果您在查看代码时遇到问题,可以使用链接来显示代码: https://dl.dropboxusercontent.com/u/104961902/code.txt
答案 0 :(得分:1)
您的第一个if语句未关闭
我认为您在文件的最后缺少}
。
改变这个:
echo "<p>Something is wrong!</p>";
}
}
?>
到此(以及最后的额外}
:
echo "<p>Something is wrong!</p>";
}
}
}
&GT;