#! /usr/local/bin/perl

print "Content-type:text/html\n\n";

use DBI;

sub suicide {
    $SIG{'ALRM'} = sub { die "Error: Timed Out\n" };
    alarm(30);
}
&suicide;

# set the environment variables needed to connect to the database
BEGIN {
          $ENV{ORACLE_HOME} = '/pkgs2/oracle8.0.4/app/oracle/product/8.0.4';
          $ENV{TWO_TASK}    = 'CMPS';
          $ENV{TNS_ADMIN}    = '/pkgs2/oracle8.0.4/app/oracle/product/8.0.4/network/admin';
          $ENV{ORACLE_SID}  = 'CMPS';
    }
 

# set the user id and password
@data_sources=DBI->data_sources("Oracle");
$user="youruser_name";
$pass="your_password";
 

#connect to the database
$dbh=DBI->connect("dbi:Oracle:",$user,$pass) ;

# Report an unsuccessful connection:
     die "Couldn't connect: $DBI::errstr" unless $dbh;
 
 

#prepare the sql statement and execute
my $sth = $dbh->prepare("select count(*) from userdetails where loginname ='$login'");
$sth->execute();

# now process the results
while(@row = $sth->fetchrow)
{
$loginid = $row[0];
$pwd = $row[1];
$type = $row[2];

.....do the processing.....
...
...
...
}

#disconnect from the database
$dbh->disconnect;

sub dienice {
                my($msg) = @_;
                print "<h2>Error</h2>\n";
                print $msg;
                exit;
}