0

I have a client who is running OpenX (formerly PHPAdsNew), which is no longer being developed, and is not compatible with newer versions of PHP (as ereg and its variants are depreciated); the issue here is that I can't really tell what the ereg is supposed to be replacing to rewrite the line.

The old code is:

define ('phpAds_path', ereg_replace("[/\\\\]admin[/\\\\][^/\\\\]+$", '', __FILE__));

I would be very greatful for anyone's ideas!

0

1 Answer 1

0

Just add delimiters around the regex:

ereg_replace("[/\\\\]admin[/\\\\][^/\\\\]+$", '', __FILE__)

becomes:

preg_replace("~[/\\\\]admin[/\\\\][^/\\\\]+$~", '', __FILE__)
//     here __^                  and here __^
Sign up to request clarification or add additional context in comments.

2 Comments

I've tried that, it doesn't parse the URL.; I think it removes the admin bit from the URL, but I have no clue what the last section of the regex is for.
@JamesCorthell: Your regex maches: a slash (or backslash) then the literal 'admin' then a slash (or backslash) then anything that is not a slash (or backslash) until the end of the string.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.