Instead of taking illegal characters out for the user, wouldn't it be better
to not process the submission and send an error message back to them... like
"Please enter a username with only letters and numbers. No spaces or special
characters allowed".
Then you could just use ereg.
if ( ereg("^[[:alnum:]]+$" , $_POST['username'] ) {
// process submission
} else {
// don't process submission... have user enter another username
}
You might want to set a limit on the length though...
... ereg("^[[:alnum:]]{3,10}$", ...
----- Original Message -----
> From: "Marian Briones" <[EMAIL PROTECTED]>
>
> >
> > It is coming in off a form submission. I don't want any spaces, and
> > alpha numeric characters only. For the filename of the photo, I know
> > I can just copy that up to the server with an identifier, but for the
> > incoming username on the form, I already had someone thinking they
> > were smooth by putting in a URL like
> > www.theircompany.com<http://www.theircompany.com>for their
> > desired webspace name. No no no. I want to make sure the .'s are
> > stripped out of there and if they have spaces or characters like #!$@
> etc.
> >
> > WHat is the syntax to do this? And what function? ereg_replace?
>
>
--
katy
~~+++~~ +
no matter where you go,
there you are
+ ~~+++~~
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hcp9nj8/M=362131.6882499.7825260.1510227/D=groups/S=1705005703:TM/Y=YAHOO/EXP=1123458875/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~->
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/