#!/usr/bin/perl #LOGIN CGI Program #IDとパスワードが与えられた場合は認証Loginしてセッションを渡し #Upload.cgiにRedirectする。 #与えられていないときで、セッションがある場合は自動でUpload.cgiに #Redirectする。 #セッションがない場合はupload.htmlにリダイレクトする。 use CGI; use DBI; my $cgi=CGI->new; my $user = 'nengaorg'; my $passwd = 'win32q'; my $db = DBI->connect('DBI:mysql:nengaorg:localhost', $user, $passwd) ||die $db->errstr; $sql = "select * from tblfile where shflg between 21 and 26 order by rand()"; $sth = $db->prepare($sql) || die $db->errstr; $sth->execute() ||die $sth->errstr; @columns = $sth->fetchrow_array; die $sth->errstr if $sth->err; $sth->finish(); $db->disconnect(); if($columns[1]=~/(\w+)\.(\w\w\w)/){ print $cgi->redirect("/html/$1".".html"); }