PDA

View Full Version : cgi/perl wierd sutuff hapening with my SHORT code help please!


solarwind
12-06-2005, 10:40 PM
this is my code for the perl cgi:
#!/usr/bin/perl -wT

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

my $data = param('t1');
my $pass = "password";

print header;
print start_html("$data");

print "$data";

if ($data==$pass)
{
print "PASSWORD OK";
}

print end_html;

and this is for the .html file i use:
</form>


<form name=f2 action="../cgi-bin/p1.cgi" method="POST">
<input type="text" name="t1"><br>
<input type="submit" value="Send">
</form>

The code is just supposed to take info from one textbox and print a satement based on a condition which is: if $data == $pass

THIS IS MY WEBSITE BY THE WAY:

http://www.solarwind.memebot.com

regardless of what you type in and press submit, it always prints PASSWORD OK

it's only supposed to print PASSWORD OK when the $data == $pass (my $pass = "password") (password is the password)
can someone help me please?

Im not that good with perl

thankyou

FishMonger
12-06-2005, 11:10 PM
Try changing it to a string comparisson

if ($data eq $pass)

solarwind
12-06-2005, 11:15 PM
WOW THANKS!!!

IT WORKED!!! =]

I really appreciate your help, thankyou!!!