Without having the if-else clause, everything went fine, it just printed out the main page. But after putting in the Session and auth stuff, I sometimes get the page, but mostly the server seems to hang in an endless loop... Netscapes comets keep moving, but there's no response. There seems to be nothing wrong on the server, system load and process list show nothing unusual. I guess it has to do with table locking, but actually I didn't even try to enter a login and passwd, I just hit Reload. Any ideas?# this is index.pl use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use strict; use Perlnews; my $q = new CGI; my $n = new Perlnews; $n->html_head(); if ($q->param("op") eq "login") { $n->auth($q->param("login"), $q->param("password")); $n->main_page(); } else { $n->main_page(); } $n->html_foot(); ---------- # And this is a part of the module I wrote ### Apache Session thingies my $request = Apache->request; my $cookie = $request->header_in('Cookie'); $cookie =~ s/PN_SESSION_ID=(\w*)/$1/; my %session; tie %session, 'Apache::Session::MySQL', $cookie, { Handle => $dbh, Loc +kHandle => $dbh }; my $session_cookie = "PN_SESSION_ID=$session{_session_id};"; $request->header_out("Set-Cookie" => $session_cookie); ## Authentication subroutine sub auth { my ($login, $passwd) = @_; $sth = $dbh->prepare("SELECT id, login FROM users WHERE login = ? +AND passwd = ENCRYPT(?, passwd)"); $sth->execute($login, $passwd); if ($sth->rows != 1) { $error = "Oops, the was something wrong with your login or pas +sword!"; } else { my $r = $sth->fetchrow_arrayref(); $session{userid} = $r->[0]; $session{login} = $r->[1]; } $sth->finish; }
In reply to mod_perl, Apache::Session by le
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |