Log In script Using Perl
Login.pl
#!/www/perl/bin/perl.exe
print "Content-type: text/html\n\n";
use CGI;
use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
use CGI::Session ( '-ip_match' );
$q = new CGI;
$usr = $q->param('usr');
$pwd = $q->param('pwd');
if($usr ne '')
{
# process the form
if($usr eq "demo" and $pwd eq "demo")
{
$session = new CGI::Session();
print $session->header(-location=>'index.pl');
}
else
{
print $q->header(-type=>"text/html",-location=>"login.pl");
}
}
elsif($q->param('action') eq 'logout')
{
$session = CGI::Session->load() or die CGI::Session->errstr;
$session->delete();
print $session->header(-location=>'login.pl');
}
else
{
print $q->header;
print <
1 comment:
Perl is the best scripting language for Text processing and handle regex. I have posted few articles related to those at my blog
http://icfun.blogspot.com/search/label/perl
Also Perl's Cpan has lots of support that I don't even need to think extra while developing project. I didn't find such help on other programming language except Java and .NET
Post a Comment