Jump to content

The output of this regular expression isn't right.


Demonic

Recommended Posts

	function PresetApps($content)

	{

		include_once("*****/*****/settings.php");

		$Settings = new Settings;//New settings class - gets the CleanString function!

		include_once("*****/******/applets.php");

		$Applets = new Applets;//New settings class - gets the CleanString function!



		$tag = array(

		'/\[uSERS_ONLINE\]/is',

		'/\[sTATS\]/is',

		'/\[uSER_CONTROLS\]/is',

		'/\[NEWS\]/is',

		'/\[sEARCH\]/is',

		'/\[FILE=(.*?)\]/e',

		);



		$feature = array(

		"". $Applets->UsersOnline() ."",

		"". $Applets->GetStats() ."",

		"". $Applets->UserControlsApp() ."",

		"". $Applets->LatestNews() ."",

		"". $Applets->SearchBox() ."",

		"''. $Applets->ExternalFile('\\1') .''",

		);



		$string = preg_replace($tag, $feature, $content);//Return the content



		return $string;

	}

 

Alright in the SQL there is a [FILE=ads] and it would include the file and output whats in the file.

 

ads.php

function ads(){

echo "This is a test";

}
ads();

 

So when the script is ran The box is working but the only thing that isn't working is the class:

 

It outputs  "ads" and not the actual function that should output "This is a test"

 

It seems like its only echoing the regular expression and ignoring the class that is being called.

 

How do I fix this?:

 

	function ExternalFile($file)

	{

		include_once("*****/*****/settings.php");

		$Settings = new Settings;

		$Settings->GetInfo();



		include($Settings->url."applets/".$file.".php");

	}

(this file is inside a class)

 

 

Can someone help me fix this error so it makes the class initiate the function.

 

Thanks in advance.

Link to comment
Share on other sites

That's pretty complex.  If I was debugging it, I would add print/echo statements all throughout the code you are interested in, to make sure the values are correct at every stage.  That should help you find the problem.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.