I am going bananas! I have tried to install the cookie mod that Old Money made. No matter what I do, I get:
"DBman has encountered an internal error. Please enable debugging to view"
I have looked over the code so many times my eyes hurt.
Could you please look to see if I missed anything?
1. downloaded Matt's Cookie Library & put in the variable:
$Cookie_Domain = '.aallsafe.com';
2. In my .cgi under required libraries I added (in blue):
require "$db_setup.cfg"; # Database Definition File
require "auth.pl"; # Authorization Routines
require 'cookie.lib'; # Session Cookie Mod
3. In my cgi sub main I added (in blue):
elsif ($in{'change_email'}) { unless ($db_userid eq "default") { &change_email; } else { &html_unauth; } }
elsif ($in{'logoff'}) { &auth_logging('logged off') if ($auth_logging);
&SetCookies('session',' ');
(-e "$auth_dir/$db_uid") and ($db_uid =~ /^[\A-Za-z0-9]+\.\d+$/) and unlink ("$auth_dir/$db_uid");
$auth_logoff ? (print "Location: $auth_logoff\n\n") : (print "Location: $db_script_url\n\n");
}
elsif ((keys(%in) <= 2) ||
($in{'login'})) { &html_home; }
else { &html_unkown_action; }
}
In the auth.pl, I changed as instructed to (changes in blue):
open(AUTH, ">$auth_dir/$db_uid") or &cgierr("unable to open auth file: $auth_dir/$uid. Reason: $!\n");
print AUTH "$view:$add:$del:$mod:$admin:$ENV{'REMOTE_HOST'}\n"; # Session Cookie Mod
close AUTH;
foreach (0 .. 3) { $permissions[$_] = int($permissions[$_]); }
&auth_logging('logged on', $userid) if ($auth_logging);
&SetCookies('session',$db_uid); # Session Cookie Mod
return ('ok', $db_uid, $view, $add, $del, $mod, $admin);
}
}
return ("invalid username/password");
}
elsif ($db_uid) { # The user already has a user id given by the program.
(-e "$auth_dir/$db_uid") ?
return ('ok', $db_uid, &auth_check_permissions($db_uid)) :
return ('invalid/expired user session');
}
else { # Session Cookie Mod
&GetCookies('session');
if (length($Cookies{'session'}) > 4) {
$db_uid = $Cookies{'session'};
if (-e "$auth_dir/$db_uid") {
open(AUTH, "<$auth_dir/$db_uid") or &cgierr("unable to open auth file: $auth_dir/$uid. Reason: $!\n");
@perm = ;
close AUTH;
($view, $add, $del, $mod, $admin, $host) = split (/:/, @perm[0]);
return ('ok', $db_uid, $view, $add, $del, $mod, $admin); }
else { return ('invalid/expired user session'); }
}
else { return 'no login'; }
}
}
I have started over about 6 times now & I keep getting the same error. Yet, when I revert back to my original auth.pl & cgi my script again works fine.
Any advice would be greatly appreciated.
Diana Rae
"DBman has encountered an internal error. Please enable debugging to view"
I have looked over the code so many times my eyes hurt.
Could you please look to see if I missed anything?
1. downloaded Matt's Cookie Library & put in the variable:
$Cookie_Domain = '.aallsafe.com';
2. In my .cgi under required libraries I added (in blue):
require "$db_setup.cfg"; # Database Definition File
require "auth.pl"; # Authorization Routines
require 'cookie.lib'; # Session Cookie Mod
3. In my cgi sub main I added (in blue):
elsif ($in{'change_email'}) { unless ($db_userid eq "default") { &change_email; } else { &html_unauth; } }
elsif ($in{'logoff'}) { &auth_logging('logged off') if ($auth_logging);
&SetCookies('session',' ');
(-e "$auth_dir/$db_uid") and ($db_uid =~ /^[\A-Za-z0-9]+\.\d+$/) and unlink ("$auth_dir/$db_uid");
$auth_logoff ? (print "Location: $auth_logoff\n\n") : (print "Location: $db_script_url\n\n");
}
elsif ((keys(%in) <= 2) ||
($in{'login'})) { &html_home; }
else { &html_unkown_action; }
}
In the auth.pl, I changed as instructed to (changes in blue):
open(AUTH, ">$auth_dir/$db_uid") or &cgierr("unable to open auth file: $auth_dir/$uid. Reason: $!\n");
print AUTH "$view:$add:$del:$mod:$admin:$ENV{'REMOTE_HOST'}\n"; # Session Cookie Mod
close AUTH;
foreach (0 .. 3) { $permissions[$_] = int($permissions[$_]); }
&auth_logging('logged on', $userid) if ($auth_logging);
&SetCookies('session',$db_uid); # Session Cookie Mod
return ('ok', $db_uid, $view, $add, $del, $mod, $admin);
}
}
return ("invalid username/password");
}
elsif ($db_uid) { # The user already has a user id given by the program.
(-e "$auth_dir/$db_uid") ?
return ('ok', $db_uid, &auth_check_permissions($db_uid)) :
return ('invalid/expired user session');
}
else { # Session Cookie Mod
&GetCookies('session');
if (length($Cookies{'session'}) > 4) {
$db_uid = $Cookies{'session'};
if (-e "$auth_dir/$db_uid") {
open(AUTH, "<$auth_dir/$db_uid") or &cgierr("unable to open auth file: $auth_dir/$uid. Reason: $!\n");
@perm = ;
close AUTH;
($view, $add, $del, $mod, $admin, $host) = split (/:/, @perm[0]);
return ('ok', $db_uid, $view, $add, $del, $mod, $admin); }
else { return ('invalid/expired user session'); }
}
else { return 'no login'; }
}
}
I have started over about 6 times now & I keep getting the same error. Yet, when I revert back to my original auth.pl & cgi my script again works fine.
Any advice would be greatly appreciated.
Diana Rae