Closed Thread Icon

Topic awaiting preservation: fopen()? readfile()? fwrite()? Pages that link to <a href="https://ozoneasylum.com/backlink?for=12663" title="Pages that link to Topic awaiting preservation: fopen()? readfile()? fwrite()?" rel="nofollow" >Topic awaiting preservation: fopen()? readfile()? fwrite()?\

 
Author Thread
Synthetic
Paranoid (IV) Inmate

From: under your rug,
Insane since: Jul 2001

posted posted 03-21-2003 19:09

I've got a file called "config.php" and in the file it has 50 lines, I want to be able to open the file for reading and write to the file in like a text area or something with a submit button to make the changes, but i need it to have it keep the same line breaks of my text file.

PHP Syntax highlighting would be cool to, but i'd settle for the correct read/write function

Just like if it were an online "notepad" only for PHP

I've tried various PHP functions for the last several hours to no avail, so here I am, any help or advice would be greatly appreciated

[This message has been edited by Synthetic (edited 03-21-2003).]

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 03-21-2003 21:04

Display:
$filename = 'config.php';
$fh = fopen($filename,'rb');
$data = fread($fh,filesize($filename))
fclose($fh);
print('<textarea name="inputData">'. htmlentities($data,ent_quotes). '</textarea>'); //the htmlentities only if you have " in your data.


store
$filename = 'config.php';
$fh = fopen($filename,'wb');
fwrite($fh,$HTTP_POST_VARS);
fclose($fh);

where's the problem with that approach?

so long,

Tyberius Prime

Synthetic
Paranoid (IV) Inmate

From: under your rug,
Insane since: Jul 2001

posted posted 03-22-2003 00:30

Looks good, thanks TP

oh you missed a colon after ($filename)) though hehe

Synthetic's Chess Player Page

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 03-22-2003 09:26

yeah, you're right.
This is a lot more pleasant with direct syntax highlighting ;-)

« BackwardsOnwards »

Show Forum Drop Down Menu