> i'm building a registration system, and i want to strip all funky
> character map symbols from the username as well. i know strip_tags()
> gets rid of html, but how do i get rid of them?? :(
> 
> i just want simple a-z, A-Z and 0-9 allowed in the username.

You'll want an ereg_replace:

  // Strip all invalid characters from the username
  $username = ereg_replace("[^0-9A-Za-z]", "", $username);

or:

  // Detect invalid characters in the username
  if (ereg("[^0-9A-Za-z]", $username))
  {
    echo "Username contains invalid characters.";
  }

Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to