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
48
Other forums
include function being weird?
I have a very simple system to grab an IP outputted by a PHP file.. (for a project I have) but it ou
How to use Substr
I want to check for the word CATEGORY: inside a string which can be CATEGORY: ITEM
and remove the
private constructor
Hello,
Can we create a constructor as private? If yes, what is the use of it? If no, why can'
Logging and nologging bulk insert
Hi,
oracle version: 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
session variable problem
Session variable is not working in Fire fox i am getting null value but it is working fine in IE.
php ajax - two drop down list with a submit button
i have created a form with 2 drop-down list and a submit button. I would like to know how to pass th
Internal Server Error issues
This has been bothering me for weeks and I've been trying to solve it without asking for help, but e
Access database inside of a validation class
Hello,
For quite some time, I have been using functions to validate form input and access the
login page does not execute a else statement
I've created a login page using sessions.
When an incorrect user name or password is entered then
Multiple websites question.
Hi, does php have any functionality that enables a programmer to extract information from a website