gurpreet Posted September 12, 2011 Share Posted September 12, 2011 I purchased Cronus' email verification mod a long time ago, and haven't looked at my website backup in over a year until today. I noticed when I put it on my WAMP server I got loads of errors to do with deprecated and I could fix them all except this one. I have no idea how to use preg_match properly, so maybe i could get some help? if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email) if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name There are more but not sure if I can post them up Quote Link to comment Share on other sites More sharing options...
Danny696 Posted September 12, 2011 Share Posted September 12, 2011 Its not hard to fix, just look into the filter_var function. Quote Link to comment Share on other sites More sharing options...
Lithium Posted September 12, 2011 Share Posted September 12, 2011 if (!preg_match("/^[^@]{1,64}@[^@]{1,255}$/", $email) this ought to work as expected... Quote Link to comment Share on other sites More sharing options...
gurpreet Posted September 12, 2011 Author Share Posted September 12, 2011 if (!preg_match("/^[^@]{1,64}@[^@]{1,255}$/", $email) this ought to work as expected... Could you please explain how you came to that so I can fix all of the other errors aswell? Thanks for that. Quote Link to comment Share on other sites More sharing options...
Lithium Posted September 12, 2011 Share Posted September 12, 2011 http://www.php.net/manual/en/function.preg-match.php Quote Link to comment Share on other sites More sharing options...
gurpreet Posted September 12, 2011 Author Share Posted September 12, 2011 Its not hard to fix, just look into the filter_var function. A lot of people are saying that filter_var doesn't work as well as preg_match, unless I'm misreading it? Quote Link to comment Share on other sites More sharing options...
Lithium Posted September 12, 2011 Share Posted September 12, 2011 SRB is correct... filter_var() does not use regex, so most likely would be you having to make a lot of recode. Quote Link to comment Share on other sites More sharing options...
gurpreet Posted September 12, 2011 Author Share Posted September 12, 2011 I dont really understand the preg_match syntax, it's confusing me with all the numbers and symbols and stuff. Could anyone dumb it down a bit and maybe explain it? Quote Link to comment Share on other sites More sharing options...
H4x0r666 Posted September 12, 2011 Share Posted September 12, 2011 i also got an error like that.. ; Deprecated: Function eregi() is deprecated in /home/*****/public_html/header.php on line 55 this is line 55: if(eregi("[\'|'/'\''<'>'*'~'`']",$ids_checkpost) || strstr($ids_checkpost,'union') || strstr($ids_checkpost,'java') || strstr($ids_checkpost,'script') || strstr($ids_checkpost,'substring(') || strstr($ids_checkpost,'ord()')){ idk if its enough information but maybe someone over here got an fast fix for this ;) Quote Link to comment Share on other sites More sharing options...
Spudinski Posted September 13, 2011 Share Posted September 13, 2011 Tip to everyone: Get your own server, and use system commands, like, I don't know... say `ereg`? $my_expression = `ereg .....`; //use it Quote Link to comment Share on other sites More sharing options...
H4x0r666 Posted September 13, 2011 Share Posted September 13, 2011 Exactly the same as has been said - it is deprecated. Ereg and eregi are almost the same, the only difference that I know of is that eregi is case-insensitive. Try: RegEx cheat sheet the code is not exactly the same since his problem was in the email part and mine is in the header '.php' as you see and also i am not an pro at this but i assume its like this? if(!preg_match("[\'|'/'\''<'>'*'~'`']",$ids_checkpost) || strstr($ids_checkpost,'union') || strstr($ids_checkpost,'java') || strstr($ids_checkpost,'script') || strstr($ids_checkpost,'substring(') || strstr($ids_checkpost,'ord()')){ only changing eregi or ereg to !preg_match ?? what exactly is the difference o.0 between this.. and eregi.. i havent tested this yet.. but let me know if this is also right^^ ? and make changes if not. thx Quote Link to comment Share on other sites More sharing options...
H4x0r666 Posted September 13, 2011 Share Posted September 13, 2011 Okay i've also searched for sql_regcase on: http://www.php.net/manual/en/reference.pcre.pattern.posix.php and its saying: sql_regcase() | No equivalent and i've got this error: Deprecated: Function sql_regcase() is deprecated in /home/*****/public_html/globals.php on line 38 and this is the line from the error.. $val = preg_replace(sql_regcase("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/"),"",$val); and it only seems to help if i remove the full sql_regcase so it would be: $val = preg_replace("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/"); someone with a explaination or possible solution (and thanks by the way for showing me those sites since changing it to "preg_match ... / ... /i" is working Quote Link to comment Share on other sites More sharing options...
gurpreet Posted September 13, 2011 Author Share Posted September 13, 2011 Got it to work, thanks a lot everyone! Quote Link to comment Share on other sites More sharing options...
H4x0r666 Posted September 13, 2011 Share Posted September 13, 2011 worked without error thanks ! :D you are the king :P Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.