Gossamer Forum
Quote Reply
Filters
Hello
Sorry, my English is not verry good.

As I can prevent, user their Pornoseiten with me posts. There are filter for it, for example bath words, or forbidden words. Greeting thanks Harry

German:
Wie kann ich verhindern, dass User ihre Pornoseiten bei mir posten. Gibt es Filter dafür, zum Beispiel Bad words, oder verbotene Wörter.
Danke Gruß
Harry

Quote Reply
Re: Filters In reply to
In add.cgi under if ($status eq "ok") {

try adding something like......
Code:
my $found;
my @bad = qw( porn sex bla );
Code:
foreach (@bad) {
if (($rec{'URL'} or $rec{'Title'}) =~ /$_/i) {
$found = 1;
}
}
Code:
if ($found == 1) {
&site_html_add_failure("No adult sites please") and return;
}
Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Filters In reply to
Hello thanks for taps. It inserted same, but to enter I can do me still with Porn... Pages. Thus it sees with me out

sub process_form {
# --------------------------------------------------------
my ($key, $status, $line, $output);

# Check the referer.
if (@db_referers and $ENV{'HTTP_REFERER'}) {
$found = 0;
foreach (@db_referers) {
$ENV{'HTTP_REFERER'} =~ /$_/i and $found++ and last;
}
if (!$found) {
&site_html_add_failure ("Auto submission is not allowed in this directory. Please visit the site to add your entry.");
return;
}
}

# This will set system fields like Validated to their proper values.
foreach $key (keys %add_system_fields) {
$in{$key} = $add_system_fields{$key};
}

# Set date variable to today's date.
$in{$db_cols[$db_modified]} = &get_date;

open (ID, "<$db_links_id_file_name") or &cgierr("error in process_form. unable to open id file: $db_links_id_file_name. Reason: $!");
$in{$db_key} = <ID> + 1; # Get next ID number
close ID;

# Validate the form input..
$status = &validate_record(%in);
if ($status eq "ok") {
my $found;my @bad = qw( porn sex );

foreach (@bad) { if (($rec{'URL'} or $rec{'Title'}) =~ /$_/i) { $found = 1; }}

if ($found == 1) { &site_html_add_failure("No adult sites please") and return;}


# Update the counter.
open (ID, ">$db_links_id_file_name") or &cgierr("error in get_defaults. unable to open id file: $db_links_id_file_name. Reason: $!");
flock(ID, 2) unless (!$db_use_flock);
print ID $in{$db_key}; # update counter.
close ID; # automatically removes file lock

# Print out the validate input to a "validation database" where it is stored until
# the admin decides to add it into the real database.
open (VAL, ">>$db_valid_name") or &cgierr("error in add_record. unable to open validate file: $db_valid_name. Reason: $!");
flock(VAL, 2) unless (!$db_use_flock);
print VAL &join_encode(%in);
close VAL; # automatically removes file lock

# Send the admin an email message notifying of new addition.
&send_email;
# Send the visitor to the success page.
&site_html_add_success;
}
else {
&site_html_add_failure($status);
}
}



Quote Reply
Re: Filters In reply to
In which field did you enter the word Porn?

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Filters In reply to
Hi
I Have found the Problem
Your Posting wars:

@bad) { if (($rec{'URL'} or $rec{'Title'} or $rec{'Description'}) =~ /$_/i) { $found = 1; }}

if ($found == 1) { &site_html_add_failure("No adult sites please") and return;}


by the Last ($found == 1} is one = over

thank you for your help
Gretting Harry

Sorry My english


Quote Reply
Re: Filters In reply to
No, it is meant to be ==

...is it working with only one?

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Filters In reply to
Rear one, it operates now and locks those out bad words. Beforehand it did not function. I then = took away.
Thanks for the good advice

Quote Reply
Re: Filters In reply to
Hmm that's strange.

Oh well at least it works.

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Filters In reply to
I must enter only the bath words. Schau whether it runs

http://www.hier-gratis.de/links/cgi-bin/add.cgi

Quote Reply
Re: Filters In reply to
So, further problem. Now in addition, normal user pages cannot enter themselves any longer to Shi.....

Quote Reply
Re: Filters In reply to
Sorry I don't understand.

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Filters In reply to
Yes my enblish. Sorry

Now, standard User can not Posting his Url

Quote Reply
Re: Filters In reply to
Try changing

my @bad = qw( porn sex bla );

to...

my @bad = ('porn', 'sex', 'bla');

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Filters In reply to
with two == it does not run. it is not blocked


Quote Reply
Re: Filters In reply to
with two == it does not run. it not blocks property auchmy @bad = (' porn ', ' sex ', ' bla '); modified

Quote Reply
Re: Filters In reply to
with one = it runs. also standard user are blocked

Quote Reply
Re: Filters In reply to
Hmm...I guess I should test code out before I post it Smile

If you do a search for "german spam" or "bad words" you should find some working code.

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: Filters In reply to
here my code:
# Validate the form input..
$status = &validate_record(%in);
if ($status eq "ok") {
my $found;my @bad = ('porn', 'sex', 'bla');

foreach (@bad) { if (($rec{'URL'} or $rec{'Title'} or $rec{'Description'}) =~ /$_/i) { $found = 1; }}

if ($found = 1) { &site_html_add_failure("Wir nehmen keine Adultseiten auf! No Adult Site Please") and return;}


Quote Reply
Re: Filters In reply to
I thank you for yours strive

Harry