MyBB Community Forums

Full Version: preg_replace as well with php5, any help?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello guys
if you used the seo plugin before
there is a function to add nofollow for the unfriendly pages url's
such as attachments.php, member.php, etc
this function used preg_replace and it's working just fine in php 4
but if you used it in php 5, it's not showing the pages at all, it's shows blank pages, and here is the code for this function.
function seo_add_nofollow($part_1, $part_2, $part_3)
{
	return stripslashes($part_1) . stripslashes($part_2) . ' rel="nofollow,noindex">'. stripslashes($part_3) .'</a>';
}
define("NOFOLLOW_UNF_LINKS", 1);
if (NOFOLLOW_UNF_LINKS == 1) {
		$page = preg_replace("#(<a.+?href=.+?(attachment|usercp|usercp2|misc|reputation|printthread|sendthread|showteam|memberlist|calendar|member|private|newreply|newthread|forumdisplay)\.php)(.+?)>(.+?)</a>#e", "seo_add_nofollow('\\1', '\\3', '\\4')", $page);
	} 

I tryed to find out why it's shows blank pages, but I was unable to slove it. the only fix I did, it's to disable this function for php5.
so any help will be very appreciate guys.
come on guys, anyone can show me where the problem with php5 here? Toungue