View Single Post
Old 06-10-2007, 11:07 PM   #1 (permalink)
Hobbit
The Visitor
 
Join Date: Apr 2007
Location: California
Posts: 4
Thanks: 0
Hobbit is on a distinguished road
Default Delete lines from txt file

Hopefully someone can help. I have a text file the data is for for example

line1
line2
line3

How can I make a php script (edit.php) that will make something like this

line1 - delete
line2 - delete
line3 - delete

I currently only have is so it shows the data of the text file but that's it.

Code:
<?php

// set file to read
$file = '/home/mypath/file.txt' or die('Could not open file!');
// open file
$fh = fopen($file, 'r') or die('Could not open file!');
// read file contents
$data = fread($fh, filesize($file)) or die('Could not read file!');
// close file
fclose($fh);
// print file contents
echo $data;

?>
I'm making a link script. Basically for lazy people like me who are too lazy to upload the sidebar everytime. I finally got it to show the live links, but I want to be able to delete links as well. Even better, I'd like to move links up and down the list but I will wait till later for that. Any help would be greatly appreciated.
Hobbit is offline  
Reply With Quote