Ok,Here is a quick 'n dirty example.
list.txt looks like this
Code:
http://www.dynamicdrive.com
http://www.digg.com
http://www.yahoo.com
http://www.google.com
http://www.ebay.com
and index.php looks like this
PHP Code:
<html>
<head>
</head>
<body>
<ul>
<?php
if(!empty($_GET['line'])){
$file = file('list.txt');
ob_start();
for($i=0;$i < count($file);$i++){
if(rtrim($file[$i]) != $_GET['line']){
echo $file[$i];
}
}
$write = ob_get_contents();
ob_end_clean();
$handle = fopen('list.txt','w');
fwrite($handle,$write);
fclose($handle);
}
$file = file('list.txt');
for($i=0;$i<count($file);$i++){
echo '<li><a href="index.php?line='.urlencode(rtrim($file[$i])).'">Delete '.rtrim($file[$i]).'</a></li>'."\n";
}
?>
</ul>
</body>
</html>
They both need to be in the same directory. Go ahead and run to see what it does
Bookmarks