jeudi 13 août 2015

html in perl keeps giving me wrong outputs i cant figure it out

This auth.pl file suppose to show login screen with username and password forms but keeps giving me the wrong outcome. What am i doing wrong here?

#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);
use CGI qw( :standard );

$user = param( "user" );
$password = param( "password" );

$user = param( "user" );
$password = param( "password" );

print <form method="GET" action="http://ift.tt/1MqFQJI">;
print "<html>";
print "<center>";
print "<h1>Login</h1>";
print 'Username<br/><input type="text" name="user"><br/>';
print 'Password<br/><input type="password" name="password"><br/>';
print '<font size="-1"><input type="submit">';
print "</center>";
print "</html>";

if ($user eq "username" && $password eq "password") {
    print "Content-type: text/html\n\n";
    print "<html>";
    print "<head>";
    print "Login Successful";
    print "</body>";
    print "</html>";
}
else {
    print "Content-type: text/html\n\n";
    print "<html>";
    print "<head>";
    print "Login Unsuccessful";
    print "</body>";
    print "</html>";
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire