#!/usr/local/bin/perl -w
$ENV{ORACLE_HOME} = '/opt/ORACLErdbms/V8.0.6.0';
use DBI;
use CGI;
$query = new CGI;
$username = $query->param('username');
$password = $query->param('password');
$dbh = DBI->connect('DBI:Oracle:eimora','cs72dc','cs72dc')
|| die "Cannot connect: $DBI::errstr";
$verify = "SELECT user_name,user_pass FROM users WHERE user_name = \'$username\'";
$mine = $dbh->prepare($verify)
|| die "Cannot prepare statement: DBI::errstr";
$mine->execute
|| die "Cannot execute statement: DBI::errstr";
($test_username,$test_password) = $mine->fetchrow_array();
$mine->finish;
if (($test_username eq $username) && ($test_username ne $null)) {
if (($test_password eq $password) && ($test_password ne $null)) {
$statement = "SELECT route FROM history WHERE username=\'$username\'";
$mine = $dbh->prepare($statement)
|| die "Cannot prepare statement: DBI::errstr";
$mine->execute
|| die "Cannot execute statement: DBI::errstr";
$route = $mine->fetchrow_array();
$mine->finish;
print<<"EOF";
Content-type: text/vnd.wap.wml
Saved Routes
$route
EOF
} else {
print<<"EOF";
Content-type: text/vnd.wap.wml
Wrong Password
Try again
EOF
}
} else {
print <<"EOF";
Content-type: text/vnd.wap.wml
Wrong Username
Try again
EOF
}
$dbh->disconnect;