RE: PHP editor

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

 



 

> -----Message d'origine-----
> De : Tim [mailto:user@xxxxxxxxxxxxx] 
> Envoyé : vendredi 13 avril 2007 18:19
> À : 'Philip Thompson'; 'php General List'
> Objet : RE:  PHP editor
> 
>  
> 
> > -----Message d'origine-----
> > De : Philip Thompson [mailto:prthomp@xxxxxxxx] 
> > Envoyé : vendredi 13 avril 2007 17:35
> > À : php General List
> > Objet : Re:  PHP editor
> > 
> > On Apr 13, 2007, at 10:26 AM, Jay Blanchard wrote:
> > 
> > > [snip]
> > > Just showing my ignorance, probably,
> > > but what exactly is meant by a "PHP editor"?
> > >
> > > Does it mean an editor for editing PHP scripts, or an 
> > editor written 
> > > in PHP?
> > > [/snip]
> > >
> > > Something to edit PHP with...unless you're trying to be funny
> > 
> > 
> > LOL! I don't know why this was so funny, but I laughed at 
> > Jay's comment (I can just see the light bulb turn on). 
> > Nonetheless, this "ignorant" user brings up a thought - are 
> > there any editors written in PHP?
> 
<?php
if ($_SERVER['SERVER_ADDR'] != '127.0.0.1') die("Local acces only"); 
$content = '';
$file_content = '';
if ($_POST['filename']) {
	$file_path = '/tmp/' . $_POST['filename'];
	if (strlen($_POST['php_editor'] > 0)) {
		$file_path = '/tmp/' . $_POST['filename'];
		if(!file_put_contents('/tmp/' .
$_POST['filename'],$_POST['php_editor'])) {
			$content .= 'Error writing to ' . $file_path . '<br
/>';
		}
		$file_content = $_POST['php_editor'];
	} elseif (strlen($_POST['php_editor'] == 0)) {
		if (file_exists($filename)) {
			$file_content = file_get_contents($filename);
		} else {
			$content .= 'Error reading from ' . $file_path .
'<br />';
		}
	}
}
$content .= '<form action="' . $_SERVER['PHP_SELF'] . '"><br />';
$content .= 'Filename:<input type="text" name="filename" id="telephone"
size="25" /><br />';
$content .= 'PHP:<textarea name="php_editor" id="my_editor" rows="10"
cols="71">$file_content</textarea><br />';
$content .= '<input type="submit" value="Save" />';
$content .= '</form><br /><br />';
echo $content;
?>

Sorry, i couldn't leave that up.. I must redeem myself..

:D

Tim

-- 
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