Date: Wed, 1 Mar 2006 20:17:20 -0500 From: Gerry Freymann <lists@interpool.ca> To: fbsd_user@a1poweruser.com Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Help with PHP eregi alnum if statement Message-ID: <20060301201720.688d1d29.lists@interpool.ca> In-Reply-To: <MIEPLLIBMLEEABPDBIEGCEHMHDAA.fbsd_user@a1poweruser.com> References: <MIEPLLIBMLEEABPDBIEGCEHMHDAA.fbsd_user@a1poweruser.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 28 Feb 2006 14:16:06 -0500
"fbsd_user" <fbsd_user@a1poweruser.com> wrote:
>I am trying to test the login id entered from a form.
>Checking that the contents are upper or lower case alpha or numeric
>0-9
>plus the special characters - dash and # pound sign
>
>Code:
>
>if(eregi("([[:alnum:]\#\-]+)", $loginid))
>  { print("loginid is alnum"); } else { print("loginid is not
>alnum");  }
>
>
>
>I get the message "loginid is alnum" no matter what I enter to test.
>
>What is wrong with the statement syntax that it don=92t work
>correctly?
 Perhaps you can modify this segment of code to allow characters and
your dash a pound sign... at the moment it allows only letters.
if (!eregi("^[_a-z0-9-]+[_a-z0-9-]+$",$form[username])) {=20
	$error .=3D "Invalid characters in Username (only a-zA-Z_-allowed)|";	=09
}=20
-gerry
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060301201720.688d1d29.lists>
