(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).]