View previous topic :: View next topic |
Author |
Message |
Barhopper Guest
|
Posted: Wed Jan 01, 2003 8:25 pm Post subject: Editing a text file |
|
|
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
|
Posted: Wed Jan 01, 2003 11:56 pm Post subject: Re: Editing a text file |
|
|
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 |
|
|
Guest
|
Posted: Sat Jan 04, 2003 12:30 pm Post subject: |
|
|
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
|
Posted: Sat Jan 04, 2003 4:25 pm Post subject: |
|
|
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 |
|
|
Guest
|
Posted: Sat Jan 04, 2003 8:17 pm Post subject: |
|
|
ah, thanx mate |
|
Back to top |
|
|
DYB -
Joined: 18 Aug 2002 Posts: 6
|
Posted: Wed Feb 05, 2003 7:32 pm Post subject: |
|
|
usually a+ works well _________________ Long Live Abyss! |
|
Back to top |
|
|
|