Reply to Re: remove specific line

Your name:

Reply:


Posted by Ron Eggler @ work on 06/20/05 13:19

Ron Eggler @ work wrote:
> [snip]
>> If it still doesn't
>> work, I don't know what will...
>
> oh very bad because it doesn't work...: :( I pasted the Code below....
>>
>> This from the manual, the chaper about variable scope: "In PHP global
>> variables must be declared global inside a function if they are going
>> to be used in that function."
>
> yup, and the code looks like this:
> [Code]
> //at the top of the file:
> $blacklist="blacklist.txt";
>
//--------------------------------------------------------------------------
> ----
> function removeEMail($email_address)
> {
> global $blacklist;
> // 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\n", 512);
> fclose($handler);
> }
> echo $email_address." removed from ". $blacklist ."<br>\n";
> }
> [/Code]

oh now I see when writing the array back to file it adds about 16 empty
returns between every address... :( why that?

[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

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