|
|
|
|
![]() ![]() |
Jul 11 2007, 10:50 PM
Post
#1
|
|
|
|||[ n00b King ]||| ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 688 Joined: 20-June 07 From: Auckland Member No.: 45,102 |
I'm trying to validate a user's desired username for a registration page. I want to detect any illegal characters being used for a username. So far i have managed to include most execpt the '\', the '\' is used for escape and treating the preceding characters literally. I try to do '\\' but i get an error because it execects another character.
CODE $ck_result = "Default"; $pattern = "/[!|@|#|$|%|^|&|*|(|)|_|\-|=|+|\||,|.|\/|;|:|\'|\"|\[|\]|\{|\}]/i"; // check for input if($uname == '') { $ck_result = "<span class='error_header'>Required!</span>"; } else if (preg_match($pattern, $uname)) { $ck_result = "<span class='error_header'>illegal characters</span>"; } I have tried looking for more info but havent found any so far. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 13th October 2008 - 01:58 PM |