Gossamer Forum
Home : Products : Links 2.0 : Customization :

Alternativ Solution to Antibot?

(Page 3 of 4)
> > > >
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
I too have followed the instructions for this mod and get the error message:

Error including libraries: Missing right curly or square bracket at /home/basshook/public_html/links/cgi-bin/admin/db_utils.pl line 627, at end of linesyntax error at /home/basshook/public_html/links/cgi-bin/admin/db_utils.pl line 627, at EOFCompilation failed in require at add.cgi line 31.Make sure they exist, permissions are set properly, and paths are set correctly

I noticed when I copy/paste the code into db_utils.pl using PSPad it doesn't look the same as your post. I tried word wrapping but that didn't look any better. Would this be the cause?

sub create_captcha_form { #----------------------------------------------------------- # Create the form for add.cgi securityrequire "admin/captcha/captcha.pl"; $crypt = &generateCode(6); if ($crypt){ $i_width = $captcha_length*$captcha_width; $output = qq|<img src="$captcha_webfolder/$crypt.png" width="$i_width" height="$captcha_height" border="0"><br> <input type="hidden" name="crypt" value="$crypt"> Enter the characters you see in the image: <input type="text" name="code" value=""><br> Note: the numbers zero (0) and one (1) do not appear in the image. Refresh/reload this page for a new image. If you are uncertain of a character, take your best guess.|; return $output; } else{ &site_html_add_failure("Code not generated (file error)! Check to be sure that the script is properly configured.") and return; } }
Nootkan

Last edited by:

nootkan: Apr 20, 2008, 5:04 PM
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
Yes, that's a problem. The hash/pound sign "#" is interpretted by perl as meaning "ignore whatever follows on this line". So,

sub create_captcha_form { #----------------------------------------------------------- # Create the form for add.cgi securityrequire "admin/captcha/captcha.pl"; $crypt = &generateCode(6); if ($crypt){ $i_width =

won't work since the require statement is being ignored.

Make the code looks like the posted code. You will have to manually put in the line breaks (enter key ). I, too, have noticed that when code is copied from these forums, it does not paste correctly, which is rather annoying!

Attached is a text file that has the mod.


Leonard
aka PerlFlunkie

Last edited by:

PerlFlunkie: Apr 20, 2008, 5:27 PM
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
Wow, thanks for the quick reply. I made the changes manually and got the captcha image to show and then filled out the form and recieved this error message:

Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@bassonhook.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Must have done something else wrong. I attached my files, I hope that's not being bold or forward. I appreciate all your help.
Nootkan

Last edited by:

nootkan: Apr 20, 2008, 6:25 PM
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
I see your error, it's very minor...

You have:
Code:
sub captcha {
#------------------------------------------
require "admin/captcha/captcha.pl";
$code = ($in{'code'}); $crypt = ($in{'crypt'});
if ($code && $crypt){
# check code $result = &checkCode($code,$crypt);
if ($result == 1){


The error is in the red lines, which should look like:
Code:

if ($code && $crypt){ # check code
$result = &checkCode($code,$crypt);

You have the definition of $result blocked by a hash.


Quick reply: you're welcome, I just happened to check my mail right after you posted...


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
Smile You're the man!! Funny how you miss the simple things, huh. I guess I was focused on finding something a little tougher instead. Anyways, mod works great. Now I'll see when I can find the time to add the other mod for the add_confirm.html page. I'm off to work. Thanks again for your help. Wink
Nootkan
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
Leonard, I'm a little confused as to how to install both these mods into the add.cgi file. I installed the captcha mod first and it overwrote the lines I now must add for the add confirm mod (I'm wondering if the mod was already in place). I assume I can add the lines from the add confirm mod above the lines from the captcha mod:Unsure

if ((keys %in != 0) && ($in{'do'} eq 'confirm')) {
&process_form_1;
}
elsif ((keys %in != 0) && ($in{'do'} eq 'add')) {
&process_form_2;

if (keys %in != 0) {
($in{'code'} ne '') ? &captcha : &site_html_add_failure("You did not enter the security code.") and return;
}

Am I right in this assumption?
Nootkan
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
The code for using both is different than using either one alone, and is at the bottom of the file I attached previously, under "Add Confirm and Captcha Together".


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
Tried placing the code into my add.cgi for both mods, but when I filled out the form it took me back to the form page instead of confirm page or success page. Is that the only code I have to change?
Nootkan
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
Did you follow all the instructions under "Add Confirm and Captcha Together"?


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
Well I don't know what I've done now, but when I try to go to the form page I get an internal server error again. I've shut down the site as I have to go on the road trucking again. (Wish I hadn't taken this on now).
Nootkan
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
I'll put the mods into the code you attached before, and send 'em to you in a PM. When you get back, they'll be ready...


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
What can I say but thank you again. I have reinstalled my backup files just to get it running while I'm away for a couple of days. It looks like I had an add confirm mod installed previously according to my back up files. That maybe what is causing me grief. Don't know for sure though. I also forgot to set my permissions for add.cgi to 755 after all the uploading and deleting I've done in the past half a day. I was able to get the captcha mod working in a way but, one thing I've noticed is that I now get the password authorization window for my admin page when clicking on the add a site link before the captcha form page will show. If I click cancel, the page loads without the captcha image. I must have a path wrong or something (I suspect the outgoing path as I wasn't sure about that one in captcha.pl) Try it here for yourself: http://www.bassonhook.com/links/cgi-bin/add.cgi

Off to bed now, thanks again I really appreciate all your support.
Nootkan

Last edited by:

nootkan: Apr 21, 2008, 10:01 PM
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
The reason the password box is appearing is due to an error in where the captcha image is being sourced. it needs to be in the public html area, not in the admin area as you have:

img src="http://www.bassonhook.com/...i-bin/admin/captcha/

It is set here:

$captcha_outputfolder = "/full/path/to/www/links/captcha"; # path to store output (no trailing slash)
$captcha_webfolder = "http://your_url.com/links/captcha"; # url to outputfolder (no trailing slash)

You need to manually create the directory, the script will do the rest.


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
I'm a little confused, in the first page of this thread you stated that you placed everything into the admin and the code was written relfecting that. That is why I put my captcha folder inside my admin directory and also put one (empty) in the root of my links folder.

Also I checked my messages and it seems that the pm you sent didn't get through for some reason.

Update: Okay I get it, you want me to point the paths to the empty directory inside the root of the links directory right? I'll give it a go.
Nootkan

Last edited by:

nootkan: Apr 23, 2008, 7:37 PM
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
Your update is correct, and I have not gotten to the other yet...


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
Okay, the captcha part works and I've backed up everything again. No worries about the other thing, get to it when/if you can and I'll keep trying to figure it out also (do me good anyways). Appreciate all your support wish there was something more I could do for you in return, then keep on thanking you.
Nootkan
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
Well I've been trying to get this to work for a while now with no luck. Frown I guess I can either have the add confirm or the captcha but not both. Crazy I've gone with the captcha for now. I've made so many changes I can't keep up with them so I've uploaded my back up again to get the site working. Has anyone got these two mods to work together using perlflunkies instructions?
Nootkan
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
Hey perlflunkie, still interested in helping me out with this one? I hope I haven't angered you or anything. Unsure
Nootkan
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
nooykan,

No problems, just a lot of other things taking time lately, with little left for the computer. I'll work on it when I can...


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
Smile You bet. I appreciate it. Wink
Nootkan
Quote Reply
Re: [nootkan] Alternativ Solution to Antibot? In reply to
Wink Perlflunkie, not trying to be pushy, just a friendly reminder in case you forgot me. Thanks in advance.
Nootkan
Quote Reply
Re: [Karl] Alternativ Solution to Antibot? In reply to
Hi there,

is here anyone who has the complete script?
On the website firstproductions.com it isn´t available any longer and I need it really, due to heavy spammers.
It didn´t find the version mit codes.txt ..... in search engines. There is only an older version.

Thanks a lot.

Karsten
Quote Reply
Re: [akdlu] Alternativ Solution to Antibot? In reply to
Attached is a zip of the captcha files...


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
Hi PerlFlunkie,

thanks a lot for this. Now I can install that.

CU
Karsten
Quote Reply
Re: [PerlFlunkie] Alternativ Solution to Antibot? In reply to
Yeah, I'm a little late to the party.

Great mod ... just installed it on one of my old sites and it works great.

One little problem, tho ... the captcha.pl script in the captcha.zip download has all the settings lines commented out.

Here's the original SETTINGS block as found in the captcha.pl script inside that captcha.zip download:

Code:
##### SETTINGS #####
#$captcha_datafolder = "/your/info/here"; # not web accessible to store database (no trailing slash)
#$captcha_database = "$captcha_datafolder/codes.txt"; # path to database file
#$captcha_imagesfolder = "$captcha_datafolder/images"; # not web accessible to store png image files (no trailing slash)
#$captcha_outputfolder = "/your/info/here"; # path to store output (no trailing slash)
#$captcha_webfolder = "http://your/info/here"; # url to outputfolder (no trailing slash)

#$captcha_expire = 300; # expire time in seconds (default five minutes: 300)
# note: once a test is submitted, the code is also expired,
# regardless if the test was passed or failed

#$captcha_width = 25; # width of character graphics
#$captcha_height = 35; # height of character graphics
####################

Make sure you remove those hash symbols (I marked them in red above) so it looks like this:
Code:
##### SETTINGS #####
$captcha_datafolder = "/your/info/here"; # not web accessible to store database (no trailing slash)
$captcha_database = "$captcha_datafolder/codes.txt"; # path to database file
$captcha_imagesfolder = "$captcha_datafolder/images"; # not web accessible to store png image files (no trailing slash)
$captcha_outputfolder = "/your/info/here"; # path to store output (no trailing slash)
$captcha_webfolder = "http://your/info/here"; # url to outputfolder (no trailing slash)

$captcha_expire = 300; # expire time in seconds (default five minutes: 300)
# note: once a test is submitted, the code is also expired,
# regardless if the test was passed or failed

$captcha_width = 25; # width of character graphics
$captcha_height = 35; # height of character graphics
####################

Took me a couple hours to figure out why the script kept barfing a fatal error: source is not of type GD::Image message. Crazy

Would've been more helpful if the CGI error had said it couldn't find the images directory, but hey, it all worked out in the end, so I'm happy. Smile

Many thanks to you, PerlFlunkie ... wherever you may be!
> > > >