View Full Version : converting deprecated function with eregi()

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>"; }

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

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

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum