Validate username in php



Use this simple code to validate the usernames in php ( maybe you need to a user registration ). The username will have only characters, numbers and _ (underscore)

$username="your username";
  if(!preg_match("/^[\.A-z0-9_\-]{1,15}$/i", $username)) echo "Your username must only contain valid characters, numbers and _";

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.

 

© 2006 - 2009 BNCScripts.com . All right reserved.