| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| SQLdumpster.com | PHP invalid characters Just a quicko, how can I define invalid characters for a user's input so that when a user registers to my site, they don't select a username such as: "#~@L@N J0N3S~#" lol, excuse the example. I only really want letters, numbers and hyphens to be used. Thanks
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #2 (permalink) |
| Account Closed | http://us2.php.net/ctype_alpha I use these functions, but i have a class that i use them, but return false if its empty. I will think about posting it or not ![]() Here it is... heh PHP Code: Last edited by axilant; 09-16-2005 at 12:28 PM. |
| |
| | #3 (permalink) |
| SQLdumpster.com | Thanks very much for the help
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #4 (permalink) |
| NamePros Regular | You should also be able to do a POSIX match. Something like this should work too: PHP Code: -Bob
__________________ The mass purge has begun. |
| |
| | #5 (permalink) |
| SQLdumpster.com | Thanks Bob, I am currently using PHP Code:
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #6 (permalink) |
| Domains my Dominion | I do like Bob suggested. A regular expression is fine and more flexible IMO. For example I use code like this to test a user name, that means only letters and figures are allowed and the string must be between 4 and 16 chars long. It does the job nicely ![]() PHP Code: |
| |
| | #7 (permalink) |
| SQLdumpster.com | sdsinc, I just changed my code to the code you posted. But how do I make it case sensitive?
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #9 (permalink) |
| SQLdumpster.com | Ah, simple as that eh? Thanks a lot
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #10 (permalink) |
| A Wealth of Knowledge | I use eregi a lot when validating email addresses and other forms of data - very useful. If you want to see other ways it can be used, check out the PHP Manual documentation http://us2.php.net/eregi -Steve |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tutorial: Getting started with PHP (The Basics) | deadserious | Webmaster Tutorials | 60 | 11-17-2007 11:35 AM |
| Googlism - What does google think of you? | deadserious | The Break Room | 55 | 12-15-2005 09:09 AM |
| Seeking php function to strip invalid characters from string | RJ | Programming | 9 | 03-31-2005 11:34 PM |