Jump to content

Archived

This topic is now archived and is closed to further replies.

MCrosbie

PHP inside a MySQL entry

Recommended Posts

Hi there,

I have PHP in a MySQL entry. I am wanting to spit this out again however the echo function somehow turns the PHP code into html and the PHP is not processed. Can you think of anyway to make it spit out the MySQL entry and run the PHP code that is inside it?

Yours Sincerely,

Michael

Share this post


Link to post
Share on other sites
evil -> [url=http://us3.php.net/manual/en/function.eval.php]eval();[/url],  ::)

me!

Share this post


Link to post
Share on other sites
I have got the below code in the database. Why isn't the <script ...> tags working?

[code]<?PHP echo '
<form action="back.php?functid='.$_GET['functid'].'" method="post" enctype="multipart/form-data" name="FormID'.$_GET['functid'].'">
<div id="xToolbar"></div>
<p>Name of page 
  <input type="text" name="title" />
  <br />
  Status <br />
<label name="statuslive"><input name="status" type="radio" value="0" /> Live to the public</label><br />
<label name="statusdevelopment"><input name="status" type="radio" value="1" /> Under development</label><br />
  Place your page on the tree:<br />
<script type="text/javascript">
<!--
tree = new treemenu(\'tree\', true, true, true, false);
tree.put(1,\'<input type="radio" name="type" value="1"><a> Add page here </a>\',\'_self\',\'\',\'Add page here\',\'\',\'\'); // For use with a form';
$var['spacing'] = "";
$var['level'] = 1;
findView($_GET['functid']);
if(isset($var['viewID'])){
$var['link'] = "front.php?functid=".$var['viewID']."&id={id}"; }
PTLevels($var['link'],'form'); // If you don’t want it for a form replace ‘form’ with ‘’.
echo '
  document.write(tree);
//-->
</script>
  <br />
  Page Description';
$oFCKeditor = new FCKeditor( 'description' ) ;
$oFCKeditor->BasePath = '../fckeditor/';
$oFCKeditor->Height = 300 ;
$oFCKeditor->ToolbarSet = 'Basic';
$oFCKeditor->Value = '' ;
$oFCKeditor->Config[ 'ToolbarLocation' ] = 'Out:xToolbar' ;
$oFCKeditor->Create() ;
echo '<br />
Contents of page<br />
';
$oFCKeditor = new FCKeditor( 'content' ) ;
$oFCKeditor->BasePath = '../fckeditor/';
$oFCKeditor->Height = 300 ;
$oFCKeditor->ToolbarSet = 'Basic';
$oFCKeditor->Value = '' ;
$oFCKeditor->Config[ 'ToolbarLocation' ] = 'Out:xToolbar' ;
$oFCKeditor->Create() ;

echo '
<br />
Template
<select name="template">
';
connectdb('');
$res['templates'] = mysql_query("Select * from DM_templates");
while($row['templates'] = mysql_fetch_array($res['templates'])){
echo '
<option value="'.$row['templates']['id'].'">'.$row['templates']['title'].'</option>
'; }
echo '
</select><br />
Permissions<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr class="table_header">
                                <td width="100">Permission</td>
                                <td>Username</td>
                              </tr>
  ';
  $var['changestyle'] = 2;
$i = 0;
$res['permissions'] = mysql_query("Select * from DM_users where userlevel < '3'");
while($row['permissions'] = mysql_fetch_array($res['permissions'])){
print("<tr ".(!($i%$changestyle)?"class='table_alternative'\"":"").
            '><td><input name="permissions[]" type="checkbox" id="permissions[]" value="'.$row['permissions']['id'].'" /></td><td>'.$row['permissions']['username'].'</td></tr>');
$i = $i+ 1;
} echo '
          </table>
  <input name="permissionscount" id="permissionscount" type="hidden" value="'.mysql_num_rows($res['permissions']).'" />
</p><br />
<div id="form_submit" align="right">
      <A HREF="javascript:document.FormID'.$_GET['functid'].'.reset()"><img name="Reset" type="image" id="Reset" alt="Cancel" border="0" src="../images/form_bcancel.png" /></a>
        <input name="Submit" type="image" id="Submit" src="../images/form_bnext.png" />
      </div></form>';
?>[/code]

Share this post


Link to post
Share on other sites

×

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.