PDA

View Full Version : Basic BASIC help with a cgi app


RandomGuy
03-21-2006, 07:41 PM
I'm having super duper duper trouble with writing a simple username password script...

so far i have
#!/usr/bin/perl
my $usrname = param("usr1");
my $passr = param ("pw1");

if username = "Username" && password = "Blah" {
## Print the page
}
else {
exit;
}

its giving me error 500.... I uploaded it to cgi-bin in ASCII and i chmodded it to 755...

anyone have any help, or even a prewritten script...

FishMonger
03-21-2006, 07:54 PM
#!/usr/bin/perl

use strict;
use CGI;

my $usrname = param("usr1");
my $passr = param("pw1");

if ($usrname = "Username" && $passr = "Blah") {
## Print the page
}
else {
exit;
}

RandomGuy
03-21-2006, 08:28 PM
i really appreciate it...
just wondering, what exactly is the significance of the Use CGI clause..

I am going to test it right now ... post up my results

RandomGuy
03-21-2006, 08:31 PM
error 500: Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.



...hrm everything seems check... Chmodded to 755, ... in CGI-BIN folder... and uploaded in ASCII format

FishMonger
03-22-2006, 05:36 PM
what exactly is the significance of the Use CGI clause..
param("usr1") is a method of the CGI module, so before you can use that method to retrieve the form field, you need to load the module that defines that method.

http://search.cpan.org/~lds/CGI.pm-3.17/CGI.pm

The error is probably comming from within the ## Print the page section. What and how are you printing the page? Please post that section of your script, so I can help troubleshoot.

mlseim
03-22-2006, 08:11 PM
comparing integers: if($number1 == $number2){

comparing strings: if($string1 eq $string2){

You might want to search Google for a Perl tutorial.
I'm guessing your script has many syntax errors.

FishMonger
03-22-2006, 10:23 PM
mlseim, good catch...I glossed over that issue.