Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Linux Programming & Scripting > cgi password scripting problem on godaddy
 Linux Programming & Scripting   C, Perl, PHP, Bash Scripts, anything programming or script related post in here!

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 08-28-2008   #1 (permalink)
Just Joined!
 
Join Date: Aug 2008
Posts: 1
cgi password scripting problem on godaddy

I have used this script successfully on another server, but get a server error pertaining to the path when I run it on my godaddy linux hosted site. It is preceded by an html page where the "test" password is entered. BTW - the folks at godaddy won't help me. But they do say it's OK to have the CGI file in the root directory (it doesn't have to reside in a folder called CGI or CGI-BIN).

Here's the code - the url's have been changed to something generic:

#!/usr/local/bin/perl
################################################## #########################
# Password Protection # Version 1.1 #
################################################## #########################
# FORM SETUP: #
# - The form can use both a GET and POST method. #
# - The input for the password must be named "pw". #
# - The input for the submit button can not have a name. #
# - There can be no other inputs inside the form. #
# EXAMPLE: #
# <FORM ACTION="password.cgi" METHOD="post"> #
# <INPUT NAME="pw" TYPE="password"> #
# <INPUT TYPE="submit"> #
# </FORM> #
################################################## #########################
# SCRIPT SETUP: #
# - This script must be uploaded in ASCII mode. #
# - The password is case insensitive. #
# - Your $page1 and $page2 pages must exist. #
# EXAMPLE: #
# $password = "the site rules"; #
# $page1 = "members_only.html"; #
# $page2 = "bad_password.html"; #
################################################## #########################
$password = "test";
$page1 = "http://www.abc.com/index.html";
$page2 = "http://www.abc/about.html";
################################################## #########################
if ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
($name, $value) = split(/=/, $buffer);
}
elsif ($ENV{'REQUEST_METHOD'} eq "GET") {
($name, $value) = split(/=/, $ENV{'QUERY_STRING'});
}
else {
print "Content-type:text/html\n\n";
print "The form method must be \"GET\" or \"POST\".";
exit;
}
$password =~ tr/[A-Z]/[a-z]/; # Delete these two lines if you want
$value =~ tr/[A-Z]/[a-z]/; # this script to be case sensitive.
$value =~ tr/+/ /;
$value =~ s/%([a-f0-9][a-f0-9])/pack("C", hex($1))/eg;
if ($value eq $password) {
print "Location: $page1\n\n";
}
else {
print "Location: $page2\n\n";
}
exit;
fhogsed is offline  

Reply With Quote
Old 08-29-2008   #2 (permalink)
Just Joined!
 
GDHosting's Avatar
 
Join Date: Aug 2008
Posts: 1
Sorry to hear you are having this issue.

Try changing:

#!/usr/local/bin/perl

to

#!/usr/bin/perl

Here is a help article with some more details, What Paths do I Use to Upload PERL Files and Use the PERL Interpreter?

Regards,
GDHosting is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Free Network Mapping Tool for Microsoft® Office Visio® Professional 2007 Users
Don't map your network by hand – let LANsurveyor Express for Microsoft Visio Professional 2007 automatically create network diagrams for you.
subscribe
Free eBook:"Vulnerability Management for Dummies"
Get all the Facts and See How to Implement a Successful Vulnerability Management Program.
subscribe
Google vs The World: The Battle of the Message Security Vendors
With such a powerful name behind it, Google Message Security stands out in a sea of products that do exactly the same thing - or so they say.
subscribe

Safe, Secure Backup


All times are GMT. The time now is 07:32 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2