On Mon, Dec 05, 2005 at 02:00:13PM -0500, Michael B Allen wrote:
> I want to validate a string for storage into a database so that it cannot
> contain any content that might be interpreted as SQL, Javascript, PHP,
> etc. Is there a standard function or technique to perform this validation?
Trying
[snip]
I want to validate a string for storage into a database so that it cannot
contain any content that might be interpreted as SQL, Javascript, PHP,
etc. Is there a standard function or technique to perform this validation?
[/snip]
The technique is regex (regular expressions), start here
http:/
> or if you aren't into regex (which I find confusing and still am trying
> to learn):
Read the book "Mastering Regular Expressions" or first 300 pages of it - trust
me, it is worth the labour (personal experience)!
On Wednesday 23 February 2005 07:44, Ligaya Turmelle wrote:
>
> if ((strlen(tr
or if you aren't into regex (which I find confusing and still am trying
to learn):
if ((strlen(trim($string)) <=6) && ctype_alpha(trim($string)))
{ echo 'good'; }
else
{ echo 'bad'; }
John Holmes wrote:
Ashley M. Kirchner wrote:
How can I check that a string is no more than 6 characters long
Ashley M. Kirchner wrote:
How can I check that a string is no more than 6 characters long and
only contains alpha characters (no numbers, spaces, periods, hyphens, or
anything else, just letters.)
if(preg_match('/^[a-zA-Z]{0,6}$/',$string))
{ echo 'good'; }
else
{ echo 'bad'; }
Change to {1,6
5 matches
Mail list logo