Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for broken captcha
  • Loading branch information
onfire4g05 committed Mar 22, 2013
1 parent dde4d7a commit cfb76a1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 9 additions & 0 deletions cgi-bin/forum/Code/Admin2.pl
Expand Up @@ -1348,6 +1348,14 @@ sub Settings3 {
if(!$advancedhtml) { $advancedhtml = 0; }
# Create a random captcha salt
if(!$captcha_random) {
$possible = '123456789ABCDFGJL^(@&!)(*^)(#*_!=MNPQRSTWXY23456789';
$temp1 = 0;
$captcha_random = '';
while($temp1 < 6) { $captcha_random .= substr($possible, int(rand(length($possible))), 1); ++$temp1; }
}
$printtofile = <<"EOT";
#####################################################
# E-Blah Bulletin Board Systems 2008 #
Expand Down Expand Up @@ -1519,6 +1527,7 @@ sub Settings3 {
\$BCAdvanced = $BCAdvanced;
\$tagsenable = $tagsenable;
\$autotag = $autotag;
\$captcha_random = "$captcha_random";
1;
EOT
Expand Down
4 changes: 2 additions & 2 deletions cgi-bin/forum/Code/Register.pl
Expand Up @@ -170,7 +170,7 @@ sub Register2 {

require Digest::MD5;
import Digest::MD5 qw(md5_hex);
$datad = md5_hex($image->random_str());
$datad = md5_hex($captcha_random . $image->random_str());

$image->create(ttf,rect);
$badimage = '<br />'.$@ if($image->gdbox_empty());
Expand Down Expand Up @@ -305,7 +305,7 @@ sub Register3 {
if($nocomputers) {
require Digest::MD5;
import Digest::MD5 qw(md5_hex);
$datad = md5_hex(uc($FORM{'random'}));
$datad = md5_hex($captcha_random . uc($FORM{'random'}));
error_reg($registertxt[71]) if($datad ne $FORM{'randomconfirm'} || !-e("$bdocsdir2/Random/$datad.png"));
unlink("$bdocsdir2/Random/$datad.png","$bdocsdir2/Random/$FORM{'randomconfirm'}.png");
}
Expand Down
6 changes: 6 additions & 0 deletions cgi-bin/forum/Setup.pl
Expand Up @@ -1287,6 +1287,11 @@ sub Step2 {
fclose(FILE);
}

$possible = '123456789ABCDFGJL^(@&!)(*^)(#*_!=MNPQRSTWXY23456789';
$temp1 = 0;
$captcha_random = '';
while($temp1 < 6) { $captcha_random .= substr($possible, int(rand(length($possible))), 1); ++$temp1; }

fopen(SETTINGS,">$root/Settings.pl");
$savesettings = <<"EOT";
####################################################
Expand Down Expand Up @@ -1385,6 +1390,7 @@ sub Step2 {
\$indextext = 0;
\$posttext = 0;
\$gdisable = 1;
\$captcha_random = "$captcha_random";
EOT
$savesettings =~ s~\\~/~sig; # Get rid of {x}:\ with Win32 systems
print SETTINGS $savesettings;
Expand Down

0 comments on commit cfb76a1

Please sign in to comment.