Gossamer Forum
Home : Products : Links 2.0 : Customization :

Ban URL mod in Links 2b5?

(Page 2 of 2)
> >
Quote Reply
Re: Ban URL mod in Links 2b5? In reply to
FiveAlrm,

How do you format multiple entries in lockout.txt file? Are the separated by line breaks, commas, or just a space?

Bob
Quote Reply
Re: Ban URL mod in Links 2b5? In reply to
I have mine separated by line breaks, but I'm not sure it really matters as long as they are not separated by commas or any other item other than spaces. It should be looking for spaces for the validation. Also, plural words aren't neccessary uless the root spelling is different. For example:

"add" will also ban "adds" however "body" will not ban "bodies"...keep this in mind when making out your list. Don't "ass"ume that it JUST looks for whole words. It also sees words within words on the submission side.
Quote Reply
Re: Ban URL mod in Links 2b5? In reply to
One more thing I forgot...add the following to the END of the code I put on here...

return;

If you don't add this, it will still get submitted for review even though they get redirected to the error page. At least the way I have it set up it does. This one line seems to make all the difference in the world if you are having that problem
Quote Reply
Re: Ban URL mod in Links 2b5? In reply to
does any1 get FireAlrm's mod working? i get internal server error when installing this mod.

reever
Quote Reply
Re: Ban URL mod in Links 2b5? In reply to
You can run the script in debug, but if you can't get it, you can try my new snippet of code to block sites in the resource centre.

------------------
------------------------------------------
Lavon Russell
LookHard! Search
http://www.lh.yi.org
webmaster@lh.yi.org
Quote Reply
Re: Ban URL mod in Links 2b5? In reply to
can you give me the url, bmxer? thanks!


reaver
Quote Reply
Re: Ban URL mod in Links 2b5? In reply to
found it! thought that you were saying somewhere else :-)

reaver
Quote Reply
Re: Ban URL mod in Links 2b5? In reply to
(Isn't this an old thread? ) I've gotten FiveAlrm's mod to work w/ templates. I'm also using the Add Confirm mod.

In add.cgi go to sub process_form
After "Check the referer" routine add
Code:
# Ban URL / Words MOD
open (FILE,"lockout.txt");
@lockout = <FILE>;
close(FILE);
foreach $lock(@lockout) {
chomp($lock);
$lock =~ tr/A-Z/a-z/;
@temp = ($in{'Title'},$in{'URL'},$in{'Category'},$in{'Description'},$in{'Contact Name'},$in{'Contact Email'});
for ($i = 0; $i <= 5; $i++) {
$temp[$i] =~ tr/A-Z/a-z/;
if ($temp[$i] =~ /$lock/) {
&site_html_add_blocked($lock);
return;
}
}
}


In modify.cgi go to sub process_form
After "local (%original);" add
Code:
# Ban URL / Words MOD
open (FILE,"lockout.txt");
@lockout = <FILE>;
close(FILE);
foreach $lock(@lockout) {
chomp($lock);
$lock =~ tr/A-Z/a-z/;
@temp = ($in{'Title'},$in{'URL'},$in{'Category'},$in{'Description'},$in{'Contact Name'},$in{'Contact Email'});
for ($i = 0; $i <= 5; $i++) {
$temp[$i] =~ tr/A-Z/a-z/;
if ($temp[$i] =~ /$lock/) {
&site_html_add_blocked($lock);
return;
}
}
}


In site_html_templates.pl add this sub
Code:
sub site_html_add_blocked {
# --------------------------------------------------------
# This routine determines how the ADD BLOCKED page will look like.

my ($errormsg) = shift;

&html_print_headers;
print &load_template ('add_blocked.html', {
error => $errormsg,
%in,
%globals
});

}


Create an Message page add_blocked.html
Code:

<html>

<head>
<title><%site_title%>: Link Blocked</title>

<STYLE>
<!--
A{text-decoration:none}
-->
</STYLE>

</head>

<BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#6633FF"
VLINK="#009999"
ALINK="#FF0000"
TOPMARGIN=2
LEFTMARGIN=2
MARGINWIDTH=1
MARGINHEIGHT=1>

<TABLE WIDTH="468" CELLPADDING="2" CELLSPACING="0" BORDER="0">
<tr bgcolor="#003366">
<td colspan="3">
<FONT SIZE="2" FACE="Verdana, Arial" COLOR="ffffff"> <%site_title%>: Link Blocked</FONT></td>
</tr>


<TR bgcolor="f0f0f0">

<td valign=bottom align=left><FONT SIZE="2" FACE="Verdana, Arial" COLOR="000000">

<p><FONT SIZE="2" COLOR="#330099" FACE="Arial,Geneva,Helvetica">
Your link cannot be added because it contains the following text or links that are not permitted:</FONT></p>
<p>
<CENTER><strong>
<%error%>
</strong></CENTER>
</p>


<BR>
<FONT SIZE="3" COLOR="#330099" FACE="Arial,Geneva,Helvetica">
<B>To make changes, use the BACK button on your browser
to return to the form.</B> </FONT> </TD>
</TR>
<TR bgcolor="#FFFFFF">

<td valign=TOP align=center>
<B><FONT SIZE="3" FACE="Verdana, Arial">
<a href="<%build_root_url%>">Home</a>
</FONT></B>
</td>
</TR>
</TABLE>

</body>
</html>

Don't forget to set up the lockout.txt file.

I think that's all. I've tested it on both add and modify --seems to work. However, there did seem to be a problem if there was a line break after the last word in lockout.txt

Bob

There was another approach to this, see thread http://www.gossamer-threads.com/...m11/HTML/000653.html

[This message has been edited by bjordan (edited August 22, 1999).]
Quote Reply
Re: Ban URL mod in Links 2b5? In reply to
Thanks bjordan, for the detail explaination.

it is a old thread that i dug out. i'll try it out and see what i get.


reever

> >