Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 05-23-2006, 07:50 PM   #1
BSOD
 
MSFanBoy's Avatar
 
Join Date: May 2006
Posts: 190
Default registration form.....[php]

This was my query:

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.
__________________

MSFanBoy is offline   Reply With Quote
Old 05-24-2006, 06:43 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default Re: registration form.....[php]

MD5 hashes are 32 chars long... the password field is only 16chars long.

the table needs to be changed to
Code:
CREATE TABLE users (  
           id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,  
           username VARCHAR(255) NOT NULL, 
		   password VARCHAR(32) 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;
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 05-24-2006, 06:47 AM   #3
BSOD
 
MSFanBoy's Avatar
 
Join Date: May 2006
Posts: 190
Default Re: registration form.....[php]

haha thanks! never would have thought of that.

Although for some reason it still doesnt write it to the database...

Any ideas?
MSFanBoy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 08:03 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0