How do I limit my ctype_alnum validation

Am Creating a login Script and i do not want users to put in number or alpha numeric characters in the username field and i use the the ctype_alnum function the problem is that the validation is also affecting the password field below is login script.

[php]


<?php if(isset($_POST[“login”])&&(empty($_POST[“username”])||empty($_POST[“password”])))
{
echo"

Please You Have to Provide a Valid Username and password

";
$staff=false;}?>
<form action="<?php $_SERVER["PHP_SELF"] ?>" method=“post”>

UserName:


<?php if(isset($_POST[“login”])&&(empty($_POST[“username”])))
{
echo"Your User Name is Required";$staff=false;
}
?>
<?php
session_start();
if(isset($_POST[“username”])&&ctype_alnum($_POST[“username”])==true)
{
echo"You are allowed to put in Numbers
"; $staff=false;
}
?>



Password:


<?php if(isset($_POST[“login”])&&(empty($_POST[“password”])))
{
echo"Your Password is Required";$staff=false;
}
?>


		</form>[/php]

so please help check the code for errors and how to limit the ctype_alnum validation to just the username field.

Sponsor our Newsletter | Privacy Policy | Terms of Service