Link to home
Start Free TrialLog in
Avatar of hwihyunee
hwihyunee

asked on

password checker written in perl

Below is the code i'm having trouble with:
what it's supposed to do is read in from a stream, which contains only ONE string, that is, the password input, then checks it if it's the right one, then puts out an HTML page according to the result.

#!/usr/bin/perl

print "Content-type:text/html\n\n";

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
$buffer=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;

if($buffer eq "mypassword"){
print "<html><head><title>Member Directory</title></head><body>";
print "<font face="arial" size="2" color="blue">This is only a test.</font>\n";
print "</body></html>";
}
else{
print "<html><head><title>Lightning from the sky</title></head><body>";
print "<font face="arial" size="2" color="blue">wrong password. try again~.</font>\n";
print "</body></html>";
}

For some reason it doesn't work. HELP ME!

- paul
Avatar of Paul Maker
Paul Maker
Flag of United Kingdom of Great Britain and Northern Ireland image

why do you not use the CGI library, you will have a easiser life

install the CGI lib and see soem examples on the net

Paul
your solution does only work for method=POST, is this what your html page soes?
Avatar of hwihyunee
hwihyunee

ASKER

Yes, i'm using POST as my method. i'm trying to use CGI library as makerp  has advised me too.
what do you get in $buffer? can you please post here.
i dont get anything.. i just get a message that reads :internal server error.  something like that...
something's definitely wrong with the code..
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You need to escape your quotes that are within quotes.

Follow this example line from your code:
print "<font face="arial" size="2" color="blue">This is only a test.</font>\n";
Should be:
print "<font face=\"arial\" size=\"2\" color=\"blue\">This is only a test.</font>\n";

dill
hwihyunee,

Did you get the solution you were looking for?

What solution, if any, did you use?

Do let us know.

Thanks,
hwihyunee,

                     Did you get the solution you were looking for?

                     What solution, if any, did you use?

                     Do let us know.

                     Thanks,
hwihyunee,

In an effort to help clean up the open questions, I am going thru old questions that I have participated in.

This question needs closed either by deleting it or PAQing it.

Please do one of the following:
1. Award points.  If a point split is necessary, post a zero point question in Customer Service specifying how to split them and a link to the question.

2. If you felt any help was worth points, then post a zero point question in the Customer Service area, with a link to the question, asking for points to be reduced then award them.

3. Otherwise, just delete it.

Thanks,
dill
hwihyunee,

The following 3 questions have been open for a long time now & need your urgent attention.

Please take some time to close these questions asap.

EE userid hwihyunee
Total questions asked 4 (100%)
Open questions 3 (75.00%)
       

Topic Area              URL              Date              
CGI   https://www.experts-exchange.com/jsp/qShow.jsp?ta=cgi&qid=20189175   10/01/01  
Macromedia Flash   https://www.experts-exchange.com/jsp/qShow.jsp?ta=flash&qid=20101592   04/04/01  
Perl   https://www.experts-exchange.com/jsp/qShow.jsp?ta=perl&qid=20072809   02/05/01  

Your help will be highly appreciated.

Thanks.
Comment from expert accepted as answer.

Thank you
Computer101
E-E Moderator