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:/
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?
Thanks,
Mike
--
PHP General Mailing List (http://www.php.net/)
To unsubscrib
> 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
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.)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
trim($a_string); // removes all newline, carriage returns, and formating
$in_str_var_name=str_replace("search_for", "replace_with",
$in_str_var_name);
replaces any strings or chars
also- check out php.net documentation on string-- many other useful
functions for string manipulation
--
PHP G
How can I check a string variable is based on alphabetical and numerical
characters?
For ex, I want to make a whois script for domainnames.
You may only use alphabetical, numerical characters and dashes ("-")
Thanks
Emek
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-m
9 matches
Mail list logo