I am trying to modify a copy of Links2 for a friend, the script had the blockurl mod installed and I have expanded it to also block by IP, email address, and bad words; similar to Pauls above, only using
require "$db_lib_path/blockurl.txt";
require "$db_lib_path/blockword.txt";
instead of
my @blockurl = qw( www.aol.com );
my @blockwords = qw( bad words );
The current blockurl.txt contains:
@blockurl = ('domain.com',domain2.com',etc')
I have been asked to make the contents of this file editable from the admin (which I have done ok
) but in the format:
domain.com
domain2.com
domain3.com
etc
ie. just a straight list, 1 domain per line, without the @blockurl = ('
This of course made it easier to edit from the admin, as now a text area just shows a nice vertical list of domains.
But the blockurl mod does not work with the file contents in this format. So I am assuming when I open the file from add.cgi to read the array of banned domains, I need to somehow transpose this back into a standard array format.
This is where I am struggling.... a lot
Unfortunately my knowledge of perl is minimal so most of what i have tried has been guesswork from looking at other code.
I can open the file and get the contents ok,
my $blockurl = $db_lib_path . "/blockurl1.txt";;
open (BLOCKURL, "< $blockurl") or &cgierr ("Unable to open: $blockurl. Reason: $!");
$domain_list = <BLOCKURL>;
close BLOCKURL;
So I get $domain_list which resembles
domain.com
domain2.com
domain3.com
etc.
(It also indents from the second line on, I'm not sure if that will be a problem)
I hoped something simple like
@blockurl = $domain_list
might give me the right output , but no, unfortunately not.
I would greatly appreciate it if one of you experts out there could point me in the right direction.
Mark