我的 register.php 一切正常,当您尝试注册时,它说一切正常,但我的数据库中没有任何内容。难道我做错了什么?
<?php
echo "<h1>Register:</h1>";
$submit = $_POST['submit'];
//form data $fullname = strip_tags($_POST['fullname']);
$username = strip_tags($_POST['username']);
$password = strip_tags($_POST['password']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
if ($submit) {
// check for existance
if ($fullname && $username && $password && $repeatpassword) {
if ($password == $repeatpassword) {
//check char length of username and fullname
if (strlen($username > 25) || strlen($fullname) > 25) {
echo "Length of username or fullname is too long! Max 25 characters for each!";
} else {
//check password length
if (strlen($password) > 25 || strlen($password) < 6) {
echo "Password must be between 6 and 25 characters";
} else {
//register the user!
//encrypt password
$password = ($password);
$repeatpassword = ($repeatpassword);
//open database
$connect = mysql_connect("localhost","user","password")
or die ("Couldn't Connect!");
mysql_select_db("user_phplogin");
//select database
$queryreg = mysql_query("
INSERT INTO `user_phplogin`.`users` (`id`, `fullname`, `username`, `password`) VALUES (NULL,'$fullname','$username','$password') ");
die("You have been registered! <a href='login.html'> Return to login page</a>");
echo "Success!!";
}
}
} else
echo "Your passwords do not match!";
} else
echo "Please fill in <b>all</b> fields!";
}
?>