Delete multiple users
Posted: Mon Mar 08, 2004 1:10 pm
Hi !
I'm trying to work on a file where I store data about my e-mail subscribers (e-mail, IP and registration date). Now with checkboxes in a form I want to select some of them to be deleted.
I get an array with their info(e-mail address) in $delete_users, and I'm using this script.
The problem is it prints the full list as many times as values are in $delete_users, with one deletation on each. What should I do to print only once the list with all the deletion at a time?
I understand why this happens but can“t find the way to make it work correctly.
I'm trying to work on a file where I store data about my e-mail subscribers (e-mail, IP and registration date). Now with checkboxes in a form I want to select some of them to be deleted.
I get an array with their info(e-mail address) in $delete_users, and I'm using this script.
Code: Select all
<?
$delete_users = $_POST['$delete_users'];
$file = $fullpath."my_list.php";
$filedat = file($file);
while(list(,$v) = each($delete_users)) {
foreach($filedat as $value){
list($e_mail,$_ip,$reg_date) = explode("|",$value);
if ($e_mail!=$v){
$data = "$e_mail|$_ip|$reg_date|\n";}
else $data = "";
$fp = fopen($file,"w");
fputs($fp,$data);
fclose($fp); }
}
?>I understand why this happens but can“t find the way to make it work correctly.