...

View Full Version : converting deprecated function with eregi()



lampie1978
07-14-2012, 09:44 PM
Hi all,

I am trying to resolve a function i ones written with eregi(), but i cann't seem to resolve it with preg_match /i.

Can someone give me the right way?

This function needs to secure my DB against anti-injection.

Thanks in advance.



if (eregi("[a-zA-Z0-9]+", $nickname))
{ $nickname = trim(str_replace($verboden, '', strtolower($nickname))); } else { $nickname = HACK; echo "nickname:" .$nickname. "<br>"; }

gvre
07-15-2012, 03:17 PM
if (preg_match('#^[a-z0-9]+$#i', $nickname))

lampie1978
07-16-2012, 07:55 PM
Thanks that worked.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum