You are here: Re: [PHP] php not activated « PHP « IT news, forums, messages
Re: [PHP] php not activated

Posted by Marcus Bointon on 10/30/05 16:56

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация