How to add the routine from rate.cgi that stops multiple ratings to add.cgi to stop multiple submissions? I already have the BlockURLs mod and the Automatic Duplicate URL Check mod but now need to prevent multiple submissions from the same IP who is spamming with different URLs of the same content.
May 16, 2001, 3:46 AM
Veteran / Moderator (18436 posts)
May 16, 2001, 3:46 AM
Post #2 of 15
Views: 8997
Try adding a bit where a cookie is added. This will stop the less determined abusers, but not the more determined ones
.
I'm not very good with Perl and Cookies, so I'm afraid I can't offer you any sugestions, but maybe some of the other more experienced users such as Eliot can help you
Andy
webmaster@ace-installer.com
http://www.ace-installer.com

I'm not very good with Perl and Cookies, so I'm afraid I can't offer you any sugestions, but maybe some of the other more experienced users such as Eliot can help you

Andy
webmaster@ace-installer.com
http://www.ace-installer.com
May 16, 2001, 5:06 AM
Veteran (19537 posts)
May 16, 2001, 5:06 AM
Post #3 of 15
Views: 8988
Um actually this was discussed like yesterday and the discussions can be found in both the Links2 Customization and Discussion forums....
Please search next time.
Also Andy - to brush up your cookie skills go to perl.com and seach the CGI docs for "cookie", surprisingly.
Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/
Please search next time.
Also Andy - to brush up your cookie skills go to perl.com and seach the CGI docs for "cookie", surprisingly.
Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/
May 16, 2001, 5:14 AM
Veteran / Moderator (1203 posts)
May 16, 2001, 5:14 AM
Post #4 of 15
Views: 8992
Replace:
# We are processing the form.
if (keys %in != 0) {
&process_form;
}
With:
# We are processing the form.
if (keys %in != 0) {
&logger;
}
Add the sub:
sub logger {
# --------------------------------------------------------
# Log the IP
if (open (LOG, "<addsite.txt")) {
chomp (@IP = <LOG>);
foreach $ip (@IP) {
$ip eq $ENV{'REMOTE_ADDR'} and ($visited++ and last);
}
close LOG;
if (!$visited) {
push (@IP, $ENV{'REMOTE_ADDR'});
open (LOG, ">addsite.txt") or &cgierr ("Can't open for output counter file. Reason: $!");
if ($db_use_flock) { flock (LOG, 2) or &cgierr ("Can't get file lock. Reason: $!"); }
local $" = "\n";
print LOG "n@IP";
close LOG;
&process_form;
}
else {
&site_html_add_failure ("not allowed to submit another site") and return;
}
}
else {
open (LOG, ">addsite.txt") or &cgierr ("Can't increment counter file 'addsite.txt'. Reason: $!");
print LOG "n$ENV{'REMOTE_ADDR'}";
close LOG;
&process_form;
}
}
Glenn
Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
# We are processing the form.
if (keys %in != 0) {
&process_form;
}
With:
# We are processing the form.
if (keys %in != 0) {
&logger;
}
Add the sub:
sub logger {
# --------------------------------------------------------
# Log the IP
if (open (LOG, "<addsite.txt")) {
chomp (@IP = <LOG>);
foreach $ip (@IP) {
$ip eq $ENV{'REMOTE_ADDR'} and ($visited++ and last);
}
close LOG;
if (!$visited) {
push (@IP, $ENV{'REMOTE_ADDR'});
open (LOG, ">addsite.txt") or &cgierr ("Can't open for output counter file. Reason: $!");
if ($db_use_flock) { flock (LOG, 2) or &cgierr ("Can't get file lock. Reason: $!"); }
local $" = "\n";
print LOG "n@IP";
close LOG;
&process_form;
}
else {
&site_html_add_failure ("not allowed to submit another site") and return;
}
}
else {
open (LOG, ">addsite.txt") or &cgierr ("Can't increment counter file 'addsite.txt'. Reason: $!");
print LOG "n$ENV{'REMOTE_ADDR'}";
close LOG;
&process_form;
}
}
Glenn
Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
May 16, 2001, 6:06 AM
Veteran (1345 posts)
May 16, 2001, 6:06 AM
Post #5 of 15
Views: 8990
I found this cookie a long time ago. It allows a popup window to show only 1 time per day. It's neat because you can have a popup to present something important to your visitors, but the popup doesn't keep coming up each time that page is called.
Perhaps the cookie could be altered to help prevent spamming the add.cgi, rate.cgi, deadlink.cgi and other scripts.
I got this cookie at either (I think) http://javascript.internet.com or http://www.wsabstract.com.
Here it is:
ONE-TIME-A-DAY POPUP COOKIE
I hope this helps.
DT
Perhaps the cookie could be altered to help prevent spamming the add.cgi, rate.cgi, deadlink.cgi and other scripts.
I got this cookie at either (I think) http://javascript.internet.com or http://www.wsabstract.com.
Here it is:
ONE-TIME-A-DAY POPUP COOKIE
I hope this helps.

DT
May 16, 2001, 3:06 PM
Veteran / Moderator (1203 posts)
May 16, 2001, 3:06 PM
Post #9 of 15
Views: 8959
If you want it allow up to 2 submissions a day, change sub logger to:
sub logger {
# --------------------------------------------------------
# Log the IP
$time = time();
if (open (LOG, "<addsite.txt")) {
chomp ($old_time = <LOG>);
chomp (@IP = <LOG>);
(($time - $old_time) > 86400) and (@IP = ());
foreach $ip (@IP) {
$ip eq $ENV{'REMOTE_ADDR'} and ($visited++ and last);
}
close LOG;
if ($visited < 2) {
push (@IP, $ENV{'REMOTE_ADDR'});
open (LOG, ">addsite.txt") or &cgierr ("Can't open for output counter file. Reason: $!");
if ($db_use_flock) { flock (LOG, 2) or &cgierr ("Can't get file lock. Reason: $!"); }
local $" = "\n";
print LOG "n$time\n@IP";
close LOG;
&process_form;
}
else {
&site_html_add_failure ("not allowed to submit another site") and return;
}
}
else {
open (LOG, ">addsite.txt") or &cgierr ("Can't increment counter file 'addsite.txt'. Reason: $!");
print LOG "n$time\n$ENV{'REMOTE_ADDR'}";
close LOG;
&process_form;
}
}
Glenn
Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
sub logger {
# --------------------------------------------------------
# Log the IP
$time = time();
if (open (LOG, "<addsite.txt")) {
chomp ($old_time = <LOG>);
chomp (@IP = <LOG>);
(($time - $old_time) > 86400) and (@IP = ());
foreach $ip (@IP) {
$ip eq $ENV{'REMOTE_ADDR'} and ($visited++ and last);
}
close LOG;
if ($visited < 2) {
push (@IP, $ENV{'REMOTE_ADDR'});
open (LOG, ">addsite.txt") or &cgierr ("Can't open for output counter file. Reason: $!");
if ($db_use_flock) { flock (LOG, 2) or &cgierr ("Can't get file lock. Reason: $!"); }
local $" = "\n";
print LOG "n$time\n@IP";
close LOG;
&process_form;
}
else {
&site_html_add_failure ("not allowed to submit another site") and return;
}
}
else {
open (LOG, ">addsite.txt") or &cgierr ("Can't increment counter file 'addsite.txt'. Reason: $!");
print LOG "n$time\n$ENV{'REMOTE_ADDR'}";
close LOG;
&process_form;
}
}
Glenn
Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
May 17, 2001, 10:06 AM
Veteran / Moderator (1203 posts)
May 17, 2001, 10:06 AM
Post #12 of 15
Views: 8978
I'm interested how? To open a logfile, check if the ip address apears more than twice and if not log the ip in just 5 lines?
Glenn
Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
Glenn
Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
May 17, 2001, 2:06 PM
Veteran (19537 posts)
May 17, 2001, 2:06 PM
Post #13 of 15
Views: 8949
Instead of just stating that your code is better and shorter it would be nice if you posted it for us to see (and learn from)
Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/
May 27, 2001, 11:40 AM
Veteran (1345 posts)
May 27, 2001, 11:40 AM
Post #14 of 15
Views: 8843
I've been trying glennu's code above that would allow up to 2 URL submissions from a single IP per day. So far, it's working great. Thanks, glennu!
I also wanted to see if I could allow up to 5 submissions per day. So, I changed
to
However, when I did this, I was able to submit more than 5. In fact, no error page ever came up no matter how many submissions I made. When I switched it back to 2, it worked okay, again.
Is there something else that I should be changing?
Thanks so much.
DT
I also wanted to see if I could allow up to 5 submissions per day. So, I changed
to
However, when I did this, I was able to submit more than 5. In fact, no error page ever came up no matter how many submissions I made. When I switched it back to 2, it worked okay, again.
Is there something else that I should be changing?
Thanks so much.

DT
Apr 5, 2004, 7:54 AM
Novice (40 posts)
Apr 5, 2004, 7:54 AM
Post #15 of 15
Views: 8674
Hi Glenn,
I seem to be having trouble with this 2 submissions a day mod, it seems that there is only ever 1 date and 1 IP listed in the addsite.txt file, no matter how many submitters add a link.
So when the routine checks to see if visited the answer is always no, and hence it it will always allow multiple submissions.
I have implemented the mod exactly as your instructions above. Am I missing something?
Mark
I seem to be having trouble with this 2 submissions a day mod, it seems that there is only ever 1 date and 1 IP listed in the addsite.txt file, no matter how many submitters add a link.
So when the routine checks to see if visited the answer is always no, and hence it it will always allow multiple submissions.
I have implemented the mod exactly as your instructions above. Am I missing something?

Mark