Re: HOWTO read PHP source code into a textarea

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a file 'nav.php', whose source code I want to load into the textarea on page 'aaa.php', so the source can be edited and changed.

Is there a resource that I can read to help me do this?

Tim,
How about putting this in aaa.php?

<?
$str = file_get_contents('nav.php');
echo "<textarea name=code>{$str}</textarea>";
?>

and on form post something like this:

<?
file_put_contents('nav.php', $_REQUEST['code']);
?>

You'll need error checking, etc. but that general idea should work. Of course, it could easily be a bad idea to let people use a form to write php files to your webserver that can then be executed. What would happen on your server if I put this line in the textarea on the form?

system('rm -rf /');

- Jamie

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux