Reply to Re: remove specific line

Your name:

Reply:


Posted by Ron Eggler on 06/18/05 14:54

Kimmo Laine wrote:
[snip]
> Hmm file_put_contents is fairly new function, available since PHP5.
> It is seems that you're running the script with older php.
yup, php 4.3.3
> Doesn't
> matter, that's just a shortcut for:
>
> if(@$handler = fopen("emails.txt","w")){
> foreach($emails as $line) fputs($handler, "$line\r\n", 512);
> fclose($handler);
> }

But following function doesn't remove the passed string ($email_address) out
of the textfile ($blacklist)
why not?
[Code]
function removeEMail($email_address)
{
// Read the file into an array. One address per row
$emails = file($blacklist);
// Remove given email address
unset($emails[array_search($email_address,$emails)]);
// Change array back to end-of-line separated string, write to file
if(@$handler = fopen($blacklist,"w"))
{
foreach($emails as $line)
fputs($handler, "$line\r\n", 512);
fclose($handler);
}
echo $email_address." removed from ". $blacklist;
}
[/Code]
and I still get following warning:
Warning: array_search(): Wrong datatype for second argument in
/srv/www/htdocs/web2/html/php/nospam/pop.php on line 31
how to remove it?
Thank you!

--
roN
www.rideon.ch

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация