Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need short regex for form validation

Status
Not open for further replies.

Bastien

Programmer
Joined
May 29, 2000
Messages
1,683
Location
CA
trying to validate some input that can be either numeric or alpha...am trying to figure out a short regex that i can use to pick up those values that may lead to sql injection attacks...

any ideas?

TIA

Bastien

cat, the other other white meat
 
Hi,

There are also these:

$var1 = $_POST["message"];
$search = array (&quot;'<'&quot;, &quot;'>'&quot;);
$replace = array (&quot;<&quot;, &quot;>&quot;);
$var2 = preg_replace ($search, $replace, $var1);

$message = addslashes($var2);

-----------------------------------------------

$var1 = nl2br(stripslashes($message));

Hope this helps!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top