can you help me with my code, kindly give me or take a look at my codes in embedding a captcha pls...thanks...asap!
<?php
$submit = $_POST['register'];
//form data
$first = strip_tags($_POST['first']);
$middle = strip_tags($_POST['middle']);
$last = strip_tags($_POST['last']);
$username = strip_tags($_POST['username']);
$password = strip_tags($_POST['password']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$email = strip_tags($_POST['email']);
$street = strip_tags($_POST['street']);
$hno = strip_tags($_POST['hno']);
$hadd = strip_tags($_POST['hadd']);
$town = strip_tags($_POST['town']);
$city = strip_tags($_POST['city']);
$country = strip_tags($_POST['country']);
$zip = strip_tags($_POST['zip']);
$number = strip_tags($_POST['number']);
$admin = '2';
if ($submit)
{
$connect = mysql_connect("localhost","root");
mysql_select_db("ctt");
$querygetusername = mysql_query("SELECT username FROM users WHERE username='$username'") ;
$countuser = mysql_num_rows($querygetusername);
$querygetemail = mysql_query("SELECT email FROM users WHERE email='$email'") ;
$countemail = mysql_num_rows($querygetemail);
//check for existance
if ($first&&$middle&&$last&&$username&&$password&&$repeatpassword&&$email&&$number&&$street&&$hno&&$hadd&&$town&&$city&&$country&&$zip)
{
if ($countuser==0)
{
if ($countemail==0)
{
if ($password==$repeatpassword)
{
//check char length of username and fullname
if (strlen($username)>25||strlen($name)>25)
{
echo "<font color='#ea9898'>Length of username or fullname is too long!</font> </br></br>";
}
else
{
//check password length
if (strlen($password)>25||strlen($password)<6)
{
echo "<font color='#ea9898'>Password must be more than 6 characters!</font></br></br>";
}
else
{
//register the user
//encryption
$password = md5($password);
$repeatpassword = md5($repeatpassword);
//open db
$connect = mysql_connect("localhost","root");
mysql_select_db("ctt");
$queryreg = mysql_query("
INSERT INTO users VALUES ('','$first $middle $last','$username','$email','$number','$street St. #$hno $hadd, $town, $city - $country - $zip','$password','$admin')
");
die ("<center><img src='images/check.png'></br><font color='red'>You have been successfully registered!<a href='login.php'><img src='images/log.png' border='0'></a></font></center>");
}
}
}
else
echo "<font color='red'><img src='images/del.png' align='left'> Your passwords do not match!</font></br></br>";
}
else
echo "<font color='red'><img src='images/del.png' align='left'> Email already in use!</font> </br></br>";
}
else
echo "<font color='red'><img src='images/del.png' align='left'> Username already exist!</font> </br></br>";
}
else
echo "<font color='red'><img src='images/del.png' align='left'> Please fill in all fields!</font></br></br>";
}
?>
<font size="2px" color="#0180b9"><b>Register</b></font><br>
<form action='register.php' method='POST'>
First Name
</td>
<input type="text" name="first" value="<?php echo $first; ?>" style="width:100%">
</td>
Middle Name
</td>
<input type="text" name="middle" value="<?php echo $middle; ?>" style="width:100%">
</td>
Last Name
</td>
<input type="text" name="last" value="<?php echo $last; ?>" style="width:100%">
</td>
</tr>
<br><br>
<b>Other Required Info</b><br><br>
</td>
</tr>
Contact Number
</td>
<input type="text" name="number" value="<?php echo $number; ?>" style="width:100%">
</td>
</tr>
Username
</td>
<input type="text" name="username" value="<?php echo $username; ?>" style="width:100%">
</td>
</tr>
Email Address
</td>
<input type="text" name="email" value="<?php echo $email; ?>" style="width:100%">
</td>
</tr>
Password
</td>
<input type="password" name="password" value="<?php echo $password; ?>" style="width:100%">
</td>
</tr>
Repeat Password
</td>
<input type="password" name="repeatpassword" value="<?php echo $repeatpassword; ?>"style="width:100%">
</td>
</tr>
<br><br>
<b>Complete Home Address</b><br><br>
</td>
</tr>
Street
</td>
<input type="text" name="street" value="<?php echo $street; ?>" style="width:80%"> St.
</td>
</tr>
<br>
Home Number<br>
</td>
# <input type="text" name="hno" value="<?php echo $hno; ?>" style="width:40%">
</td>
</tr><br>
Home Address
</td>
<input type="text" name="hadd" value="<?php echo $hadd; ?>" style="width:100%">
</td>
</tr>
Town
</td>
<input type="text" name="town" value="<?php echo $town; ?>" style="width:100%">
</td>
</tr>
City/Province
</td>
<input type="text" name="city" value="<?php echo $city; ?>" style="width:100%">
</td>
</tr>
Country
</td>
<input type="text" name="country" value="<?php echo $country; ?>" style="width:100%">
</td>
</tr>
<br>
Zip Number<br>
</td>
<input type="text" name="zip" value="<?php echo $zip; ?>" style="width:50%"><br><br>
</td>
</tr>
<a href='login.php'><b>• Log In</b></a>
<input type="submit" name="register" value='Register'>