Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 10-13-2004, 10:05 AM   #1 (permalink)
Crazy
 
Location: Arnold, MD
[php]File editor errors...

I'm having a problem with this php file editor... It will open a text file correctly but whatever I change to it isn't saved. Where did I go wrong on this code. There is a working example here.

http://www.coolgrindz.com/newsite/editor.php

PHP Code:
<?php
$save 
$_GET['save'];
$file $_GET['file'];
if (empty(
$save)) {
    if(
file_exists($file))
     {    
    
$fp fopen($file "r");
    
$content fread($fpfilesize($file));
    
$content ereg_replace("<""<"$content);
    
$content ereg_replace(">"">"$content);
    
fclose($fp);
    }
    
?>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF'?>">
    File: <input type="text" name="file" value="<?php echo $file?>" class="border" /><br />
    Content:<br />
    <textarea NOWRAP rows="15" cols="90" name="content" class="border"><?php echo $content?></textarea><br>
    <input name="save" type="submit" value="Save" class="button"><input type="reset" value="Clear" class="button">
    </form>
    <?php
}
else {
    
$content ereg_replace("<""<"$content);
    
$content ereg_replace(">"">"$content);
    
$content stripslashes($content);
    
$fp fopen($file "w");
    
fwrite($fp$content);
    
fclose($fp);
}
?>
j0hnb is offline  
Old 10-13-2004, 10:28 AM   #2 (permalink)
Junkie
 
It looks like you're querying the $_GET array when the form method is POST. Try querying $_POST['save'], $_POST['file'], etc. The file permissions must be set appropriately on *nix systems too.
SinisterMotives is offline  
 

Tags
editor, errors, phpfile


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 03:01 AM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62