This was my query:
And here is my register.php
Problem is it doesn't write the data to the database, although the error message for the password works wonderfully, well actually I won't know until it successfully writes to the database.
Code:
CREATE TABLE users (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
password VARCHAR(16) NOT NULL,
email VARCHAR(255) NOT NULL,
aim VARCHAR(255) NOT NULL,
msn VARCHAR(255) NOT NULL,
yim VARCHAR(255) NOT NULL,
location VARCHAR(255) NOT NULL,
bio VARCHAR(255) NOT NULL,
website VARCHAR(255) NOT NULL,
regip VARCHAR(255) NOT NULL,
regdate VARCHAR(255) NOT NULL
)
TYPE = myisam;
And here is my register.php
Code:
<?php
$host = "localhost";
$db = "tcp_prank";
$user = "tcp_prank";
$dbpass = "prank";
mysql_connect($host, $user, $dbpass) or die('Error connecting to the database');
mysql_select_db($db) or die('Could not select database');
$username = $_POST['username'];
$pass = $_POST['pass'];
$confpass = $_POST['confpass'];
$email = $_POST['email'];
$aim = $_POST['aim'];
$msn = $_POST['msn'];
$yim = $_POST['yim'];
$location = $_POST['location'];
$bio = $_POST['bio'];
$website = $_POST['website'];
$regip = $_POST['regip'];
$regdate = $_POST['regdate'];
?>
<form action="" method="POST">
*Username: <input type='text' name='username'>
<Br>
*eMail: <input type='text' name='email'>
<Br>
*Password: <input type='password' name='pass'>
<BR>
*Confirm Password: <input type='password' name='confpass'>
<br>
AIM: <input type='text' name='aim'>
<Br>
MSN: <input type='text' name='msn'>
<BR>
YIM: <input type='text' name='yim'>
<BR>
Website: <input type='text' name='website'>
<Br>
Location: <input type='text' name='location'>
<Br>
Biography: <input type='text' name='bio'>
<input type='hidden' name='regip' value='<?php echo $_SERVER['REMOTE_ADDR']; ?>'>
<input type='hidden' name='regdate' value='<?php echo date('m/d/y'); ?> '>
<Br>
<input type='submit' name='submit' value='Register'>
</form>
<?php
$secure_pass = md5($password);
if($pass != $confpass){
echo "Your password does not match the confirmed password";
} else {
$query = ("INSERT INTO `users` (`username`, `pass`, `email`, `aim`, `msn`, `yim`, `location`, `bio`, `website`, `regip`, `regdate`) VALUES ('$username', '$pass', '$email', '$secure_pass', '$aim', '$msn', '$yim', '$location', '$bio', '$website', '$regip', '$regdate')");
}
?>
Problem is it doesn't write the data to the database, although the error message for the password works wonderfully, well actually I won't know until it successfully writes to the database.