Zubrag.com
March 18, 2019, 08:25:51 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Simple PHP editor  (Read 9835 times)
SlovenianBoy
Newbie
*
Posts: 5


« on: January 18, 2008, 05:08:10 PM »

Very handy:

Code:
<?php
$file 
'file.txt';

echo 
'<div style="border: 1px solid; text-align:center;">';
if (isset(
$_POST['edit']))
{
  
$contents stripslashes($HTTP_POST_VARS['edit_file']);

  
$handle fopen($file'w');
  
fwrite($handle$contents);
  
fclose($handle);

  echo 
"\n<br />File Updated Successfully!<br />\n";
}

$contents = (@file_get_contents($file)) ? htmlspecialchars(file_get_contents($file)) : 'new file';

echo 
'<br /><form method="post">
<textarea name="edit_file" wrap="virtual" cols="90" rows="40">' 
$contents '</textarea>
<br /><br /><input type="submit" name="edit" value="Save"></form>
</div>'
;
?>

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC