Menu
I have some form validation done, but it’s not very good. How do i make sure that users can only use a-z, A-Z, 0-9. Would this help make sure my site is more secure. (there for users would not be able to use special characters)
Here is the code i have so far:
[code=php]// check that username is 5 characters or more
$username = $_POST[‘username’];
if (strlen($username) > 4){
}
else {
die
//email validation – i got this from a script
$email = $_POST[’email’];
if(eregi(“^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$”, $email)) {
}
else {
die
how can i make sure that the $username only can have a-z, A-Z, 0-9