Jump to content


Photo

PHP inside a MySQL entry


  • Please log in to reply
2 replies to this topic

#1 MCrosbie

MCrosbie
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 05 October 2006 - 08:21 AM

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

#2 printf

printf
  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 05 October 2006 - 02:32 PM

evil -> eval();::)

me!

#3 MCrosbie

MCrosbie
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 05 October 2006 - 09:43 PM

I have got the below code in the database. Why isn't the <script ...> tags working?

<?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>';
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users