eregi to preg


Posted on 16th Feb 2014 07:03 pm by admin

Im converting my regex for php 5.3 and I am stuck on the following

Code: [Select]if((eregi("<[^>]script*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*object*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*iframe*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*applet*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*meta*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]style*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*form*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*img*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]*onmouseover*"?[^>]*>", $secvalue)) ||
(eregi("<[^>]body*"?[^>]*>", $secvalue) && !eregi("<[^>]tbody*"?[^>]*>", $secvalue)) ||
(eregi("([^>]*"?[^)]*)", $secvalue)) ||
(eregi(""", $secvalue)) ||
(eregi("forum_admin", $sec_key)) ||
(eregi("inside_mod", $sec_key))) {
block_ip($blocker_row);
}

anyone got any ideas on how to convert this to preg.so far I have this

Code: [Select]$html_regex = '{
^(
(?: <scriptb[^>]*>.*?</script> # script block
| <objectb[^>]*>.*?</object> # object block
| <iframeb[^>]*>.*?</iframe> # iframe block
| <appletb[^>]*>.*?</applet> # applet block
| <metab[^>]*>.*?</meta> # meta block
| <styleb[^>]*>.*?</style> # style block
| <formb[^>]*>.*?</form> # form block
| <imgb[^>]*>.*?</img> # img block
| <onmouseoverb[^>]*>.*?</onmouseover> # onmouseover block
| <bodyb[^>]*>.*?</body> # body block
)*+
)$
}isx';
if (preg_match($html_regex, $html_string))

No comments posted yet

Your Answer:

Login to answer
227 Like 48 Dislike
Previous forums Next forums
Other forums

Variable passed to each() is not an array or object
Hi,

This is a email a friend type of form, and it isn't working anymore.

<?

User feedback after MySQL query has been executed
Hi all, I've just registered on PHPFreaks because I've got a question that I simply can't work out b

Auto fill in input value based on User_ID
Hello,

I'm looking form some input on the following problem.

User loads page ->

Add a sign-up feature to a flat file login script
I'm working on a flat file login script and I would like to add a sign-up feature to it with a email

Error with login script
I am getting an error with my login script:

Error:
Code: Warning: Cannot modify header inf

Hit counter updating once per IP - IP HIT COUNTER
I have a hit counter, for the amount of views on a tutorial.
It'll do the query and then do..

rdns with php
I am trying to build a script that will show all of the different domains that are hosted on the sam

Issue Parsing XML into table
Hello all,

Im a bit new to php and new to phpfreaks. But thanks in advance for the help!
<

upload control not working with update panel
Hi,

I am working with Asp.Net FileUpload control with ajax update panel,

if i use the

Array question
Does anyone know how to create a program that takes the $ amount for 8 different departments and gi

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash