Well just saying it might not help so i will show my code
functions.php
<?
function randomcode() {
$available = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 1, 2, 3, 4, 5, 6, 7);
# Above is a list of everything allowed in the string
for($i = 1; $i <= 25; $i++) {
$tmp = mt_rand(0, ( sizeof($available) - 1 ));
$str[] = $available[$tmp];
} // End for loop
return @join($str);
}
function randomval() {
$available = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
# Above is a list of everything allowed in the string
for($i = 1; $i <= 5; $i++) {
$tmp = mt_rand(0, ( sizeof($available) - 5 ));
$str[] = $available[$tmp];
} // End for loop
return @join($str);
}
function cleanstringp($password) {
$password = htmlspecialchars($password);
$password = addslashes($password);
$password = mysql_escape_string($password);
$password = strip_tags($password);
}
function cleanstringu($username) {
$username = htmlspecialchars($username);
$username = addslashes($username);
$username = mysql_escape_string($username);
$username = strip_tags($username);
} ?>
Register.php
<?
include('config.php');
include("functions.php");
$valcode = randomval();
if (!$_POST[!register])
{ ?>
<form name="form1" method="post" action="">
<table width="277" border="1" align="center">
<tr>
<td width="107">Username</td>
<td width="84"><input name="username" type="text" value="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="password" type="password" id="password" value="password"></td>
</tr>
<tr>
<td><p>Confrim Password </p>
</td>
<td><input type="password" name="cpassword" value="password"></td>
</tr>
<tr>
<td>Email</td>
<td><input name="email" type="text" id="email" value="email@email.com"></td>
</tr>
<tr>
<td>Confrim Email </td>
<td><input name="cemail" type="text" value="email@email.com"></td>
</tr>
<tr>
<td><input name="val" type="val" maxlength="5"></td>
<td><? print($valcode); ?> </td>
</tr>
</table>
<div align="center">
<input type="submit" name="register" value="register">
</div>
</form>
<? } ?>
<?
if ($_POST[register]) {
$username = $_POST[username];
$password =$_POST[password];
$cpassword =$_POST[cpassword];
$email =$_POST[email];
$cemail =$_POST[cemail];
$val =$_POST['val'];
$reg ="" ;
if($username==NULL|$password==NULL|$cpassword ==NULL|$email==NULL|$cemail==NULL|$val==NULL ) {
echo "A field was left blank.";
}else{
if($password!=$cpassword){
echo "Passwords Dont Match";
}
else { if($email!=$cemail){
echo " Emails dont Match";
}
else{
if($val!= $valcode){
echo "Validation Codes Dont Match";}
}}}}?>