<?php
$fullname=strip_tags($_POST['fullname']);
$username=strip_tags($_POST['username']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$date=date("Y-m-d");
$submit=$_POST['submit'];
?>
<html>
<h1>REGISTER !</h1>
<form action='register.php' method='POST'>
<table border =25 color=black align=center space=5 >
<tr>
<td>Full Name:</td>
<td><input type='text' name='fullname' value='<?php echo $fullname; ?>'></td>
</tr>
<tr>
<td>User Name :</td>
<td><input type='text' name='username' value='<?php echo $username; ?>'></td>
</tr>
<tr>
<td>Password :</td>
<td><input type='password' name='password'></td>
</tr>
<tr>
<td>Confirm Password:</td>
<td><input type='password' name='repeatpassword'></td>
</tr>
<td><input type='submit' value='Register !'</td>
</table>
</form>
</html>
<?php
$fullname=strip_tags($_POST['fullname']);
$username=strip_tags($_POST['username']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$date=date("Y-m-d");
if($submit)
{
//check for existance
if($fullname&&$username&&$password&&$repeatpassword)
{
//encrypt password
$password=md5($password);
$repeatpassword=md5($repeatpassword);
if($password==$repeatpassword)
{
echo"Password dont match";
}
elseif(strlen($password)>25||strlen($password)<6)
{
echo"Password must be between 6 and 25 characters";
}
elseif(strlen($username)<20||strlen($fullname)>25)
{
echo"Username or fullname is too long";
}
}
else
{
echo"fill all fields";
}
}
else
echo"Registered Successfully";
$connect = mysql_connect("localhost","root","");
mysql_select_db("phplogin");//select database
$query=mysql_query ("
INSERT INTO users VALUES('','$fullname','$username','$password','$date')
");
die("you have been registered !<a href='index.php'>click</a>here to log in");
?>
coolsid01 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.