<?php
require_once 'database.php';
?>
<body>
<form method="post" action="regcheck.php" name="register">
<br>
<label for="username">Username: </label>
<br>
<input id="username" class="input_field" type="text" onmouseout="if(this.value==''){this.value='Username...';}" onclick="javascript:void(0);if(this.value=='Username...'){this.value='';}" maxlength="150" value="Username..." size="35" name="user">
<br>
<br>
<label for="password">Password: </label>
<br>
<input id="password" class="input_field" type="password" onmouseout="if(this.value==''){this.value='Password...';}" onclick="javascript:void(0);if(this.value=='Password...'){this.value='';}" maxlength="100" value="Password..." size="35" name="pass">
<br>
<br>
<label for="email">Email: </label>
<br>
<input id="email" class="input_field" type="email" onmouseout="if(this.value==''){this.value='Email...';}" onclick="javascript:void(0);if(this.value=='Email...'){this.value='';}" maxlength="100" value="Email..." size="35" name="email">
<br />
<br />
<input id="search_btn" type="submit" value="Continue" >
<b>I agree to the Terms & Conditions.</b>
<br>
</form>
<?php
if(
isset( $_POST['user'] ) &&
isset( $_POST['pass'] )
isset( $_POST['email'] ))
{
if( strlen( $_POST['user'] ) < 4 )
{
echo "Username Must Be More Than 4 Characters.";
}
elseif( strlen( $_POST['pass'] ) < 4 )
{
echo "Passwrod Must Be More Than 4 Characters.";
}
elseif( strlen( $_POST['email'] ) < 4 )
{
echo "Email must be valid.";
}
elseif( $_POST['pass'] == $_POST['user'] )
{
echo"Username And Password Can Not Be The Same.";
}
else
{
include( 'database.php' );
$username = mysql_real_escape_string( $_POST['user'] );
$password = md5( $_POST['pass'] );
$email = ( $_POST['email'] );
$sqlCheckForDuplicate = "SELECT username FROM user WHERE username = '". $username ."'";
if( mysql_num_rows( mysql_query( $sqlCheckForDuplicate ) ) == 0 )
{
$sqlRegUser = "INSERT INTO
user( username, password, email )
VALUES(
'". $username ."',
'". $password ."',
'". $email ."',
)";
if( !mysql_query( $sqlRegUser ) )
{
echo "You Could Not Register Because Of An Unexpected Error.";
}
else
{
echo "You Are Registered And Can Now Login";
$formUsername = $username;
header ('location: Login.php');
}
}
else
{
echo "The Username You Have Chosen Is Already Being Used By Another User. Please Try Another One.";
$formUsername = $username;
}
}
}
else
{
echo "You Could Not Be Registered Because Of Missing Data.";
}
?>
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE