hey am gettng 5 errors on my registration page but i cant seem to find them...and its causing people to not get to register at my site can u help me out....here is the registration page....
PHP Code:
//-----------REGISTRATION PAGE-------------//
<?php
include("connect.php");
include("function.php");
connectdb();
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
echo "<head>";
echo "<meta name=\"keywords\" content=\"chat,free,pics,photos,videos,myspace\"/>";
echo "<meta name=\"description\" content=\"Mobile community where you can meet people, chat, share pics and videos and play games on your cell phone.\"/>";
echo "<title>Register</title>";
echo "<link href=\"css/122538344.css\" rel=\"stylesheet\" type=\"text/css\" />";
echo "</head>";
echo "<body>";
echo "<p>";
if(isset($_POST['submit']))
{
$error = '';
$nm = trim($_POST['name']);
$nm = mysql_real_escape_string($nm);
$nm = strip_tags($nm);
$nm = htmlentities($nm);
$nm = str_replace('#','',$nm);
$nm = str_replace('--','',$nm);
$ps = $_POST['pass'];
$ps = trim(mysql_real_escape_string($ps));
$utaken = mysql_fetch_array(mysql_query("SELECT count(*) FROM c_users WHERE name='".$nm."'"));
if($utaken[0]>0)
{
$error = "<div class=\"error\">$nm is unavailable. Please try another user name!</div>";
}
else if(trim($nm)==NULL)
{
$error ="<div class=\"error\">User name is required. Please fill out user name field!</div>";
}
else if(strlen($nm)<4)
{
$error = "<div class=\"error\">User name should be 4 - 20 characters long!</div>";
}
else if(strlen($nm)>20)
{
$error ="<div class=\"error\">User name cannot exceed 20 characters. Make it shorter!</div>";
}
else if($ps==NULL)
{
$error = "<div class=\"error\">Password is required, should not be identical to the user name and not too obvious!</div>";
}
else if(strlen($ps)<6)
{
$error = "<div class=\"error\">Password should be 6 - 20 characters long!</div>";
}
else if(strlen($ps)>20)
{
$error = "<div class=\"error\">Password cannot exceed 20 characters!</div>";
}
else if(trim($nm)==$ps)
{
$error = "<div class=\"error\">Username and Password cannot be the same!</div>";
}
else if (ereg("^[^@]{1,64}@[^@]{1,255}$", $nm))
{
$error = "<div class=\"error\">Username is Invalid!. -_ . are the only special characters allowed!</div>";
}
else if (ereg("^[^@]{1,64}@[^@]{1,255}$", $ps))
{
$error = "<div class=\"error\">Password is Invalid!. special characters are not allowed in Password!</div>";
}
else
{
$ipadd=$_SERVER['REMOTE_ADDR'];
$brws = explode(" ",$_SERVER['HTTP_USER_AGENT']);
$one = $brws[0];
$success = mysql_query("INSERT INTO c_users SET name='".$nm."', pass='".$ps."', ipadd='".$ipadd."', browserm='".$one."', regdate='".time()."'");
if(success)
{
$uid = mysql_fetch_array(mysql_query("SELECT id FROM c_users WHERE name='".$nm."'"));
$msg = "Welcome to sitename!. Thanks for joining sitename, the best community on your phone!. [br/]Tips to get started: [br/] 1. Bookmark the login page, write down your username and password if you wish to. [br/] 2. Upload a photo by your phone or by sending a email to: myphoto@sitename.com. [br/] 3. Last but not least tour the site and get familiar with it. Now go have some fun!.";
$msg = mysql_escape_string($msg);
autopm($msg, $uid[0]);
echo "<h3>Welcome to sitename.com</h3>";
echo "<p>";
echo "<u><b>Your login Details</b></u>:<br/>";
echo "Username: <b>$nm</b><br/>";
echo "Password: <b>$ps</b><br/>";
echo "<b><a href=\"welcome.php?u=$nm&p=$ps\">Login Now</a></b><br/>";
echo "</p>";
echo "<div class=\"foot\">";
echo "sitename © 2010 All Rights Reserved";
echo "</div>";
exit;
}
else
{
echo mysql_error();
}
}
}
echo "</p>";
?>
<p style='text-align: center'>
<img src='img/logo.gif' alt='+'/>
</p>
<h3>Join sitename</h3>
<?php echo $error; ?>
<form method='post' action='<?php $_SERVER["PHP_SELF"]; ?>'>
<p>
<b>User Name</b>:<br />
<input type='text' size='15' name='name' value='<?php $_POST['name']; ?>' maxlength='20'/><br />
<b>Password</b>:<br />
<input type='password' size='15' name='pass' maxlength='20'/><br />
<input type='submit' class='submitter' name='submit' value='Register'/><br />
</p>
</form>
<p>
Already a Member? <a href='login.php'>Login now!</a>
</p>
<div class='foot'>sitename © 2010 All Rights Reserved</div>
</body>
</html>
Comment