View Single Post
  #3 (permalink)  
Old 03-05-05, 01:00 PM
STphp STphp is offline
Newbie Coder
 
Join Date: Nov 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
To delete a line, just make a form with a text field in where users submit their email address or something and call the field 'email' and use this to remove the line from the file:

PHP Code:

<?php


$Lines 
file("users.txt");
$cLines count($Lines);
$dlete $_POST['email'];

  foreach(
$Lines as $Key => $Val) { 

   
$Data[$Key] = explode("|"$Val);

    if ( 
trim($Data[$Key][1]) == $dlete ) {

     unset(
$Lines[$Key]);
     
$fp fopen("users.txt""w");
     
$fw fwrite($fpimplode(''$Lines));
     
fclose($fp);

    }

  }

print 
"Deleted";

?>
__________________
Shaun
Reply With Quote