Editing a text file

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Barhopper
Guest





PostPosted: Wed Jan 01, 2003 8:25 pm    Post subject: Editing a text file Reply with quote

Hi, I am kinda new to PHP an I need a little help find how to edit a text file online, I can read and write them but can anyone give me a tip or two on how to edit them??

Thanks,

Matt
Back to top
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Jan 01, 2003 11:56 pm    Post subject: Re: Editing a text file Reply with quote

Barhopper wrote:
Hi, I am kinda new to PHP an I need a little help find how to edit a text file online, I can read and write them but can anyone give me a tip or two on how to edit them??

Do you mean you want to let people edit a file using a browser?
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Guest






PostPosted: Sat Jan 04, 2003 12:30 pm    Post subject: Reply with quote

yes, like to write you could use:

That as the form:
<html>
<head>
<title> Add New IP </title>
</head>
<body bgcolor="#ffffff">

<form action="writefile.php" method="post">
<font face="Verdana"><font size="2">Write To File:</font> <input type="text" name="ip" size="30"><font size="2"><br>
<br>
</font>
<input type="submit" value="Save Data >>"><font size="2"> </font></font>
</form>

</body>
</html>

and then this to write:
<?php
################
#Code By BarHopper#
################
$fName = @$_POST["file"];

$values .= "$ip\r\n";

$fp = @fopen("file.txt", "w") or die("Couldn't open file for writing!");
$numBytes = @fwrite($fp, $values) or die("Couldn't write values to file!");

@fclose($fp);
echo "Wrote $numBytes bytes to clip.txt successfully!";

?>
Back to top
!Keys
-


Joined: 23 Nov 2002
Posts: 156
Location: Holland, Enschede

PostPosted: Sat Jan 04, 2003 4:25 pm    Post subject: Reply with quote

edit them is instead of w, w+

find more info about file reading editing etc etc at php.net
_________________
!Keys || MwM^computerware
Back to top View user's profile Send private message MSN Messenger
Guest






PostPosted: Sat Jan 04, 2003 8:17 pm    Post subject: Reply with quote

ah, thanx mate
Back to top
DYB
-


Joined: 18 Aug 2002
Posts: 6

PostPosted: Wed Feb 05, 2003 7:32 pm    Post subject: Reply with quote

usually a+ works well
_________________
Long Live Abyss!
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group