Help!
I have a file with lots of info repeated over and over like so:
link
From: fname lname
IP: 192.168.0.1
Date: 2002-09-18 23:21:43
Title: email@@.email
URL: http://codewalkers.com
Description: a php site
I am building a form that among other things, needs to delete certain items from this list. I have a list of e-mail addresses, and if the address is specified, then I need to remove that item. This is the closest I've come, but two problems, first, it's only getting rid of the last element with an e-mail in the e-mail array, and second, it writes link twice on the first line. I've looked at it for too long, and now I can barely remember what I was doing. I tried using strstr(), array_intersect(), and array_pop() to no avail. Can anyone offer any advice?
<?php
//info:
//$data is the data sourse
//$pop is the e-mail address array
//$data2 is where the new list should go
$fpa = fopen($data,'r');
$fda = fread($fpa, filesize($data));
fclose($fpa);
$fdlinesa = explode("__link__", $fda);
for ($i = 0; $i < sizeof($fdlinesa); $i++) {
foreach($pop as $pop2) {
if (strstr($fdlinesa[$i], $pop2)) {
array_splice($fdlinesa,$i,1); }
}
}
$fy = fopen($data2,'w');
foreach ($fdlinesa as $towrite) {
fwrite($fy, "__link__");
fwrite($fy, $towrite); }
?>