When using the '>' in my 'strlen' function, everything that comes after it just appears in code form on the screen, do i have to use a '>' alternative or is there something i don't know about using that character, many thanks in advance!
<?
$reg = @$_POST['reg'];
//declaring variables to prevent errors
$firstname = ""; //First Name
$lastname = ""; //Last Name
$username = ""; //Username
$email = ""; //Email
$email2 = ""; //Email 2
$password = ""; //Password
$password2 = ""; // Password 2
$signupdate = ""; // Sign up Date
$usercheck = ""; // Check if username exists
//registration form
$firstname = strip_tags(@$_POST['firstname']);
$lastname = strip_tags(@$_POST['lastname']);
$username = strip_tags(@$_POST['username']);
$email = strip_tags(@$_POST['email']);
$email2 = strip_tags(@$_POST['email2']);
$password = strip_tags(@$_POST['password']);
$password2 = strip_tags(@$_POST['password2']);
$signupdate = date("Y-m-d"); // Year - Month - Day
if ($reg) {
if ($email==$email2) {
// Check if user already exists
$usercheck = mysql_query("SELECT username FROM users WHERE username='$username'");
// Count the amount of rows where username = $un
$check = mysql_num_rows($usercheck);
//Check whether Email already exists in the database
$echeck = mysql_query("SELECT email FROM users WHERE email='$email'");
//Count the number of rows returned
$emailcheck = mysql_num_rows($echeck);
if ($check == 0) {
if ($emailcheck == 0) {
//check all of the fields have been filed in
if ($firstname&&$lastname&&$username&&$email&&$email2&&$password&&$password2) {
// check that passwords match
if ($password==$password2) {
// check the maximum length of username/first name/last name does not exceed 25 characters
if (strlen($username)>25||strlen($firstname)>25||strlen($lastname)>25) {
echo "The maximum limit for username/first name/last name is 25 characters!";
}
else
{
// check the maximum length of password does not exceed 25 characters and is not less than 5 characters
if (strlen($password)>30||strlen($password)<5) {
echo "Your password must be between 5 and 30 characters long!";
}
else
{
//encrypt password and password 2 using md5 before sending to database
$password = md5($password);
$password2 = md5($password2);
$query = mysql_query("INSERT INTO users VALUES ('','$firstname','$lastname','$username','$email','$passwordd','$signupdate','0','Bio','','','no')");
die("Login Below");
}
}
}
else {
echo "Your passwords don't match!";
}
}
else
{
echo "Please fill in all of the fields";
}
}
else
{
echo "Sorry, but it looks like someone has already used that email!";
}
}
else
{
echo "Username already taken ...";
}
}
else {
echo "Your E-mails don't match!";
}
}
?>