Current location: Hot Scripts Forums » General Community » Script Requests » PHP code to edit a text file


PHP code to edit a text file

Reply
  #1 (permalink)  
Old 10-06-03, 10:27 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
PHP code to edit a text file

Hi. I'm looking for a PHP code or snippet (not a whole program) that can display a text file (.css) and let you edit it, then save it, all on the web server. I don't want a big premade program to upload since I only want this to edit one .css file on a website. I want to build a simple HTML user interface for a site owner to change their .css file without having to do html, ftp and all that. The only code I found doesn't work, it simply displays the php code in a text area and doesn't show the actual file that it is pointed to, which is the .css file i want to change. Any help or suggestions is appreciated, and I can post the code I have if it will help...Thnx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-07-03, 03:10 AM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
OK, after that long winded message, I finally got the original code to work.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 10-31-03, 06:56 PM
colincameron colincameron is offline
Newbie Coder
 
Join Date: Oct 2003
Location: Somewhere cold
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
can you post what you have.. im looking for something similar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-31-03, 09:25 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
This should be what you want. I haven't used it in awhile, but it does work pretty good.
Attached Files
File Type: zip phptextedit.zip (1.7 KB, 16153 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
The Following User Says Thank You to mdhall For This Useful Post:
jyoti (09-27-10)
  #5 (permalink)  
Old 11-18-08, 07:23 AM
folky folky is offline
New Member
 
Join Date: Nov 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Hi.....
This site is really very informative.....
Thanx.....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 09-07-10, 03:46 PM
pastel.pro pastel.pro is offline
New Member
 
Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
Thanks for your script.
I've simplified a little more :
PHP Code:

<?php

$fn 
"test.txt";

if (isset(
$_POST['content']))
{
    
$content stripslashes($_POST['content']);
    
$fp fopen($fn,"w") or die ("Error opening file in write mode!");
    
fputs($fp,$content);
    
fclose($fp) or die ("Error closing file!");
}
?>

<form action="<?php echo $_SERVER["PHP_SELF"?>" method="post">
    <textarea rows="25" cols="40" name="content"><?php readfile($fn); ?></textarea>
    <input type="submit" value="Sauver"> 
</form>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
The Following User Says Thank You to pastel.pro For This Useful Post:
jyoti (09-27-10)
  #7 (permalink)  
Old 09-27-10, 04:09 AM
jyoti jyoti is offline
New Member
 
Join Date: Sep 2010
Posts: 2
Thanks: 2
Thanked 0 Times in 0 Posts
Nice one...thanks
jyoti
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 09-27-10, 04:13 AM
jyoti jyoti is offline
New Member
 
Join Date: Sep 2010
Posts: 2
Thanks: 2
Thanked 0 Times in 0 Posts
I wanted to learn JScript..Can any one show me the way how?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 12-07-10, 05:25 PM
tjrayner tjrayner is offline
New Member
 
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
This code is brill, worked a treat for what I wanted, however it appears to add an extra line everytime I make a change, so after a few changes, if I don't remove the extra lines, there's quite alot of blank spaces at the bottom.

Any ideas will be much appreciated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #10 (permalink)  
Old 12-08-10, 09:03 PM
JohnnySaur JohnnySaur is offline
Wannabe Coder
 
Join Date: Sep 2010
Posts: 109
Thanks: 1
Thanked 2 Times in 2 Posts
I find the code very useful though I made some changes according to my preferences to come-up with suitable lay-out.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
protecting code in PHP ckb PHP 12 01-02-04 09:53 AM
Problem with Read from file by PHP Pothik Script Requests 5 09-15-03 09:42 AM
Writes to a text file gamextremer2003 JavaScript 4 09-11-03 10:43 AM
One PHP file to edit another.... drgn91 PHP 10 07-22-03 12:29 PM
edit php in Squirrelmail jrcortrightiii PHP 1 07-10-03 03:08 PM


All times are GMT -5. The time now is 01:51 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.