Greetings, fellow monks.
I'm really ashame... I'm designing a system that starts with a login screen. I check with an Access (argh) database if the user login and password are correct and then let him/her through.
The login code works perfectly with giving an error screen if both login and pass are wrong. So, I would like to separate things and give an error if the login is wrong and another one if the pass is wrong.
Well, it works perfectly with the pass, but for some weird reason, it doesn't give the error for the wrong login. Please, brothers, solve this mistery for me, since I'm stucked. Here's the code:
#!c:/perl/perl
use SysUtils;
use CGI qw/:standard/;
$login = param('login');
$pass = param('pass');
$dbh = SysUtils::Connect;
$sth = $dbh->prepare_cached("SELECT login, pass FROM usuarios WHERE lo
+gin='$login'");
$sth->execute;
while(@row = $sth->fetchrow_array())
{
if ($login eq $row[0])
{
$l = "go";
if ($pass eq $row[1])
{
$p = "go";
}
else
{
$sth->finish;
$dbh->disconnect;
SysUtils::Response2User("erro.htm","<span class=\"erro\">I
+nvalid pass.</span>","el","$login");
}
}
else
{
$sth->finish;
$dbh->disconnect;
SysUtils::Response2User("erro.htm","<span class=\"erro\">Inval
+id login.</span>","el","$login");
}
}
$sth->finish;
$dbh->disconnect;
So, isn't that stupid? Why one thing work and the other not? I've tried making this if statements in many different fashions, but none worked...
Please help me, fellows.
Thanks in advance,
Er Galvão Abbott
a.k.a. Lobo, DaWolf
Webdeveloper
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.