RE: [PHP] PHP editor
| From: | Tim | Date: | Fri, 13 Apr 2007 16:50:03 +0000 |
| Subject: | RE: [PHP] PHP editor | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252886@lists.php.net to get a copy of this message | ||
> -----Message d'origine-----
> De : Tim [mailto:user@internet46.fr]
> Envoyé : vendredi 13 avril 2007 18:19
> À : 'Philip Thompson'; 'php General List'
> Objet : RE: [PHP] PHP editor
>
>
>
> > -----Message d'origine-----
> > De : Philip Thompson [mailto:prthomp@uark.edu]
> > Envoyé : vendredi 13 avril 2007 17:35
> > À : php General List
> > Objet : Re: [PHP] 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