You are here: Re: HOWTO read PHP source code into a textarea « PHP « IT news, forums, messages
Re: HOWTO read PHP source code into a textarea

Posted by Jamie Alessio on 10/04/36 11:09

> 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

 

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

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