My name is Karina Nagahama.
I'm working on Windows NT, Apache, Perl, mod_perl, Oracle8 and DBI.
I'm making a homepage with mod_perl.
DBI with mod_perl is working well.
The 'while' command is working well too.
But I'm having problems with 'redirect' , 'if' and 'if/else' commands.
'redirect' , 'if' and 'if/else' commands are not working now.
In the pm file I declared the cgi as :
use CGI;
I also add the sentence:
use strict;
The if sentence is written as follow:
if ($Login = 'FALSE'){$Login ='<BR> Unable to login';}
if ($Login = 'TRUE'){$Login ='<BR> Welcome <BR> ';}
The if/then sentence is written as follow:
if ($Login = ' '){
$Login ='<BR> <BR> Unable to login';
} else {
print '<BR> Welcome';
}
In order to use redirect I wrote the next sentences:
my $page = new CGI;
$page->redirect('http://pisvr2/ntt/login_message.html');
Did I forget something?
Why these commands ('redirect' , 'if' and 'if/else') are not working yet?
Should I check something at the Apache's httdp.conf file ?
I wrote the .pm file as follows:
----------------------------------------------------------------------------
-------------------
package Apache::sub_login;
use strict;
use DBI;
use Apache::Constants qw(:common);
use CGI;
sub handler {
my $r = shift;
my $q = new CGI;
my $ID = $q->param('I');
my $PW= $q->param('P');
my $dbhandler = DBI->connect("dbi:Oracle:step2", "mast", "mast");
my $state = $dbhandler->prepare(q{SELECT USER_ID, PASSWORD, KOKYAKU_CD,
KYOTEN_CD
FROM T_M_WEB_USER
WHERE USER_ID=? AND PASSWORD=?});
$state->execute($ID,$PW);
#Header & title HTML;
$r->content_type('text/html');
$r->send_http_header;
my $host = $r->get_remote_host;
print $q->start_html('-title' => 'Login Screen','-bgcolor' => '#FFFFFF');
print "\n", $q->h3('Login from here'), "\n";
#my $Login=' ';
#while (my $record = $state->fetchrow_arrayref){
# $Login = '<BR> Login OK <BR>';
# $ID = $record->[0]; #[USER_ID];
# $PW = $record->[1]; #[PASSWORD];
#}
#if ($Login = ' '){
# $Login ='<BR> Unable to login!';
#} else {
# print '<BR> Welcome';
#}
my $Login='FALSE';
while (my $record = $state->fetchrow_arrayref){
$Login = 'TRUE';
$ID = $record->[0]; #[USER_ID];
$PW = $record->[1]; #[PASSWORD];
}
if ($Login = 'FALSE'){$Login ='<BR> Unable to login!';}
if ($Login = 'TRUE'){$Login ='<BR> Welcome <BR> ';}
$dbhandler->disconnect();
$r->print(<<"END");
<BR>Login : $Login
<BR> $host
<BR>Your ID is $ID
<BR>Your Password is $PW
<BR> I'll be darned - it worked
END
print "\n", $q->end_html, "\n";
return OK;
}
1;
----------------------------------------------------------------------------
------------------
Sorry for trouble you.
[EMAIL PROTECTED]