这里是我计划在我的网站的注册表格中使用的一些代码
session_start();
include ("includes/config.php");
if ($Authenticated == False) {
?>
Name: >
Surname: >
Username: >
Password: >
Retype Password: >
$name = mysql_real_escape_string($_POST['name']);
$surname = mysql_real_escape_string($_POST['surname']);
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string(md5($_POST['password']));
$passwordcheck = mysql_real_escape_string(md5($_POST['passwordcheck']));
if ($username OR $password OR $passwordcheck != null) {
if ($password == $passwordcheck) {
$query = "INSERT INTO users (name, surname, username, password) VALUES ('" . $name . "', '" . $surname . "', '" . $username . "', '" . $password . "')";
$result = mysql_query($query);
if (!$result) {
echo "Username wrong";
}
} else {
echo "passwords didnt match";
}
}
}
if ($Authenticated == True) {
header("Location: index.php");
}
?>我似乎无法得到正确的错误信息,我需要检查输入的2个密码是否相同,我还需要确保没有空白可以输入到数据库中。如果任何人都可以帮助我,将不胜感激