-3
<?php
if(isset($_POST['register']))
{
$username = $_POST["username"];
$password = $_POST["password"];
$email = $_POST["email"];
$conf_pass = $_POST["confirm"];
$error = false;

$connect = mysql_connect("localhost", "stickmi1_data", "electricCompany");
$database = mysql_select_db("account", $connect);

$usernameCheck = mysql_query("SELECT username FROM users WHERE username = '$username'");
 
// Registration Form Validation Script

if(!$username || !$password || !$email || !$conf_pass)
{
$error = true;
$errorMessage = "Please fill in any missing fields before continuing!";
}
else if($password != $conf_pass);
{
$error = true;
$errorMessage = "Your password and confirmation password don't match!";
}
if($usernameCheck > 0)
{
$error = true;
$errorMessage = "The requested username is already in use, try another!";
}
if($error == false)
{
$password = md5($password);
mysql_query("INSERT INTO users(username, password, email) VALUES($username, $password, $email)",$connect);
}
}
?>
<form name="register_form" method="post">
<table>
<tr>
<td>Username: </td>
<td><input type="text" name="username" /></td>
</tr>
<tr>
<td>Password: </td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td>Confirm Pass: </td>
<td><input type="password" name="conf_pass" /></td>
</tr>
<tr>
<td>Email: </td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td><input type="submit" name="register" value="Register" /></td>
</tr>
</table>
</form>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

2
Contributors
1
Reply
3
Views
8 Years
Discussion Span
Last Post by Will Gresham
0

1. Please use [code]

[/code] tags to post your code.
2. Tell us what the problem is, I for one would not want to read your code and then guess at the problem.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.