Re: php not activated
| From: | Marcus Bointon | Date: | Sun, 30 Oct 2005 14:56:04 +0000 |
| Subject: | Re: php not activated | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224844@lists.php.net to get a copy of this message | ||
On 30 Oct 2005, at 14:13, John Taylor-Johnston wrote:
echo $contents;PHP doesn't now that it's PHP - it just treats it as text. You can tell it to run it as PHP explicitly using: eval($contents); Eval is usually worth avoiding, but it will do what you ask. Your display function could be improved: function display() { $file = basename($_SERVER['PHP_SELF']); require 'connect.inc'; $sql = "SELECT HTML FROM
$db.$table_editor WHERE Filename LIKE '".addslashes($file)."' LIMIT 1;";
if ($myquery = mysql_query($sql) and mysql_num_rows($myquery) > 0) {
$mydata = mysql_fetch_array($myquery, MYSQL_NUM);
return $mydata[0];
}
return false;
}
Then call it:
if ($contents = display())
eval($contents);This should be faster and safer than your original code. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture marcus@synchromedia.co.uk | http://www.synchromedia.co.uk