You are here: Re: Login page perl/CGI « HTML « IT news, forums, messages
Re: Login page perl/CGI

Posted by Michael on 04/27/07 07:57

Why dont you try in alt.comp.lang.perl, for example?
This doesn't really seem like a HTML problem.

Cheers

Michael.

"sandy" <sandip.bhosale@gmail.com> schreef in bericht
news:1177653348.821250.176140@n15g2000prd.googlegroups.com...
> hello,,,,,,,,,
> i am creating login page using Perl/CGI facing prob... able to
> connect DB but from there facing prob
> If u have related code of login page in Perl please send me on
> sandip.bhosale@gmail.com
>
> please help me
>
>
> i am using MySQL as DB user name:root password:root database name:ITS
>
> and Table is User_login,
> Column 1: User_Name
> Column 2: User_Pass
>
> --
> #!c:/perl/bin/perl.exe
> use CGI qw(:standard);
> use CGI::Carp qw(warning's fatalsToBrowser);
> use strict;
> use DBI;
>
>
> print "Content-type: text/html\n\n";
> print <<BodyHTML;
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
> <html lang="en" xml:lang="en" xmlns=" http://www.w3.org/1999/xhtml">
> <head>
> <title>Registration Form</title>
> </head>
>
> <body>
> <form name = "login" action = "logincheck.cgi " method = "POST">
> <table>
> <tr>
> <td>
> User Name<br />(25 characters or less)
> </td>
> <td>
> Password<br />(8 - 15 alphanumeric characters)
> </td>
> </tr>
> <tr>
> <td><input type = "text" name = "UserName" id = "UserName" size = "25"
> maxlength = "25" tabindex = "0" />
> </td>
> <td><input type = "text" name = "Password" id = "Password" size = "15"
> maxlength = "15" tabindex = "1" />
> </tr>
> <tr>
> <td>
> <input type = "submit" value = "Login" tabindex = "2" />
> </td>
> </tr>
> <tr>
> <td>
> <p>To register go to the <a href = "register.cgi">registration</a>
> page.</p>
> </td>
> </tr>
> </table>
> </form>
> BodyHTML
> print end_html;
>
> my $dbh = DBI->connect("DBI:mysql:database:localhost","its","root",
> { RaiseError => 1,
> AutoCommit => 1 }) or &dienice("Can't connect to database:
> $DBI::errstr");
>
> my $UserName=param('UserName');
> my $Password=param('Password');
> my $sth = $dbh->prepare("select * from User_Login where User_Name
> = ?") or &dbdie;
> $sth->execute($UserName) or &dbdie;
> if (my $name = $sth->fetchrow_hashref)
> {
> my $sth = $dbh->prepare("select * from user_Login where root = ?") or
> &dbdie;
> $sth->execute($Password) or &dbdie;
> if (my $pass = $sth->fetchrow_hashref)
> {
> print redirect(- location=>"index.cgi");
> }
> else { &dienice(qq(The password is invalid. Go to the <a href =
> "passreset.cgi">password reset</a> page to reset your password.)); }
> }
> else { &dienice(qq(Username does not exist. Go to the <a href = "
> custreg.cgi">registration</a> page to register.)); }
> $dbh->disconnect;
> print end_html;
>
> sub dienice {
> my ($msg) = @_;
> print "<h1>$msg</h1>";
> exit;
> }
>
> sub dbdie {
> my ($errmsg) = "$DBI::errstr<br />";
> &dienice($errmsg);
> }
> Sandip B Bhosale.
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация