There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
bios black screen blue screen blue screen of death boot computer connection crash css dell display driver drivers email error firefox firefox 3 game hard drive internet internet explorer itunes laptop malware monitor network networking nvidia outlook outlook 2003 outlook express partition password printer problem problems router security slow software sound sprtcmd.exe trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
validating username


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
sudhakararaog's Avatar
Computer Specs
Member with 64 posts.
 
Join Date: Sep 2007
Experience: Intermediate
26-May-2008, 03:47 AM #1
validating username
i have used the following code to validate the username it is working fine

=============================================
if( $username == "" || !preg_match("/^[a-z0-9]+(?:_[a-z0-9]+)?$/i", $username) )
{
$error.="User name cannot be blank or has special characters";
}
=============================================

it does not accept UNDERSCORE at the beginning or end however while i was testing with different special characters except for # the validation works fine for all other special characters.

for example if i enter the user name as = abc#123

in this case # sign and what comes after # sign is being ignored. so in this case the username is being read as abc ONLY and not abc#123

this is very strange, how can i still validate # sign and tell the user that # sign is not a valid username like i have been doing with any other special characters like = !@$...........

please advice.

thanks.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:36 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.