I wrote something like this, but I am always hesitant to share it to general public, because there are some great security risks and vulnerabilties ,if not protected well enough against unauthorized entries.
You seem to be referring to some sort of online php editor? If so, I'd avoid that for security's sake. Ask yourself whether you really need that functionality. i always keep a development copy of the site - either on a remote testing server (secured to the nth degree!) or more often, locally - sometimes both. I'd always suggest making changes to the dev site and testing, testing, testing. Then if all seems ok, upload changes (ftp) and then test again and again and again. Different environments can cause unexpected problems. My 2p.
PS - one command often seen with this type of functionality is eval() - whatever you do - DO NOT use this unless you REALLY know what you're doing. Personally, I wouldn't touch it with a barge pole. :)