我正在尝试制作注册表单,但收到此错误:
解析错误:语法错误,第 91 行 /home/henrirkm/public_html/login/makemyaccount.php 中的意外 $end
有人可以帮助我吗?
session_start();
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
//Connect to mysql server
include "../includes/connect.php";
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
return mysql_real_escape_string($str);
}
//Sanitize the POST values
$username = clean($_POST['username']);
$fullname = clean($_POST['fullname']);
$password = clean($_POST['password']);
$cpassword = clean($_POST['cpassword']);
$email = clean($_POST['email']);
//Input Validations
if($fullname == '') {
$errmsg_arr[] = 'Enter your name';
$errflag = true;
}
if($username == '') {
$errmsg_arr[] = 'Enter username';
$errflag = true;
}
if($password == '') {
$errmsg_arr[] = 'Enter password';
$errflag = true;
}
if($cpassword == '') {
$errmsg_arr[] = 'Please fill in password confirmation';
$errflag = true;
}
if( strcmp($password, $cpassword) != 0 ) {
$errmsg_arr[] = 'The passwords did not match';
$errflag = true;
}
if($email == '') {
$errmsg_arr[] = 'Fill in email';
$errflag = true;
}
//Check for duplicate login ID
if($username != '') {
$qry = "SELECT * FROM blog_users WHERE username='$username'";
$result = mysql_query($qry);
if($result) {
if(mysql_num_rows($result) > 0) {
$errmsg_arr[] = 'Brukernavnet er allerede i bruk';
$errflag = true;
}
@mysql_free_result($result);
}
else {
die("Query failed");
}
}
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: register.php");
exit();
}else {
$qry = "INSERT INTO `blog_users`(`username`, `password`, `fullname`, `email`) VALUES ('$username','$password','$fullname','$email')";
$result = mysql_query($qry);
if($result) {
$_SESSION['username'] = $username;
$_SESSION['fullname'] = $fullname;
$_SESSION['email'] = $email;
session_write_close();
header("location: avatar.php");
exit();
}
else {
die("Sorry, but something wrong happend. Please contact admin-");
}
感谢您的帮助:)