View Full Version : --[ Perl Problem ]--
Christopher
April 22nd, 2002, 15:01
I want to get to a file inside my cgi-bin, but when I type in the addrss, it brings up a "403 Forbidden", the message is like this:
Forbidden
You don't have permission to access /cgi-bin/login_page.html on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
--------------------------------------------------------------------------------
Apache/1.3.23 Server at www.ugz.milescape.com Port 80
Whats the problem? To run my scripts and things, do I need to access them some other way? This is my first time using Perl (well the page above was just a login page to my project...) and I am very confused.
Thanx for any help!
Dusty
April 22nd, 2002, 15:48
You can't usually put HTML documents in your CGI-BIN, that's reserved for your scripts. Move it to a different directory and edit the script accordingly.
Christopher
April 22nd, 2002, 15:53
Thats it? LoL! thanx Dusty! :D
Christopher
April 22nd, 2002, 16:11
Nope, still doesn't work, now it says the error with the Perl file... (the 403 again)
Dusty
April 22nd, 2002, 16:13
Did you CHMOD it?
is0lized
April 22nd, 2002, 16:16
or upload it in ASCII
Christopher
April 22nd, 2002, 16:19
Originally posted by Dusty
Did you CHMOD it?
What to CHMOD to? 777 or 775, its at 775 right now...
Oridinally posted by is0lized
or upload it in ASCII
Ill try that now
Christopher
April 22nd, 2002, 16:22
Nevermind, it was CHMODed to the wrong thing, let me see if ot works now.
Christopher
April 22nd, 2002, 18:46
Now it just says an Internal Server error, that means something wrong with the code right?
If anyone has time, just look over it, thanx.
#!/usr/bin/perl
#-Form Processes--------------------------------------#
require "cgi-lib.pl";
&ReadParse(*input);
$username = $input{'username'};
$password = $input{'password'};
#-/Form Processes-------------------------------------#
#-File and Username+Password Work---------------------#
open(USERS,"users.file") || die("An error has occurred, please contact the <a href=\"mailto:ln33\@iprimus.ca?subject=LogInError\">administrator</a>.");
@data=<USERS>;
close(USERS);
$numberUsers = $#USERS;
$numberUsersCount = 0;
foreach $user (@data)
{
chop($user);
($usernameCheck,$passwordCheck)=split(/\|/,$user);
if($usernameCheck eq $username)
{
print "Content-type: text/html\n\n";
print "<html><head><title>Webzter</title>\n";
print "<link rel=\"stylesheet\" href=\"http://ugz.milescape.com/css.css\" type=\"text/css\">\n";
print "</head>\n";
print "<body>\n";
print "<table width=\"100%\" height=\"100%\"><tr><td>\n";
print "<table width=\"500\" height=\"200\" style=\"border:2px solid Blask\"><tr><td>\n";
print "<b>Thank you for logging in $username, please <a href=\"users/".$username.".pl\">Click Here</a></b>\n";
print "</tr></td></table>\n";
print "</td></tr></table>\n";
print "</body></html>";
}
elsif($numberUsersCount == $numberUsers)
{
print "Content-type: text/html\n\n";
print "<html><head><title>Webzter</title>\n";
print "<link rel=\"stylesheet\" href=\"http://ugz.milescape.com/css.css\" type=\"text/css\">\n";
print "</head>\n";
print "<body>\n";
print "<table width=\"100%\" height=\"100%\"><tr><td>\n";
print "<table width=\"500\" height=\"200\" style=\"border:2px solid #616161\"><tr><td>\n";
print "<b>The username or password you entered seems to be incorrect. Please retry, if the problem persists, <a href=\"mailto:ln33\@iprimus.ca?subject=WebsiteLoginError\">please contact the administrator</a>.</b>\n";
print "</tr></td></table>\n";
print "</td></tr></table>\n";
print "</body></html>";
}
else
{
$numberUsersCount++;
}
}
#-/File and Username+Password Work--------------------#
And it threw an error... So thanx in advanced.
<edit> I fixed up some minor errors, probably still some more :) </edit>
GregT
April 22nd, 2002, 19:36
are u sure ur perl path is right ?
Christopher
April 22nd, 2002, 21:07
Pretty sure, saw it in the hosts FAQ here (http://milescape.com/)
Plus there error log says this:
[Mon Apr 22 19:26:05 2002] [error] [client 216.254.165.213] File does not exist: /home/ugz/public_html/500.shtml
[Mon Apr 22 19:26:05 2002] [error] [client 216.254.165.213] Premature end of script headers: /home/ugz/public_html/cgi-bin/login.pl
An error has occurred, please contact the administrator. at /home/ugz/public_html/cgi-bin/login.pl line 14.
YUPAPA
April 23rd, 2002, 09:02
Originally posted by Christopher
Now it just says an Internal Server error, that means something wrong with the code right?
If anyone has time, just look over it, thanx.
#!/usr/bin/perl
#-Form Processes--------------------------------------#
require "cgi-lib.pl";
&ReadParse(*input);
$username = $input{'username'};
$password = $input{'password'};
#-/Form Processes-------------------------------------#
#-File and Username+Password Work---------------------#
open(USERS,"users.file") || die("An error has occurred, please contact the <a href=\"mailto:ln33\@iprimus.ca?subject=LogInError\">administrator</a>.");
@data=<USERS>;
close(USERS);
$numberUsers = $#USERS;
- YUPAPA CORRECTION - $numberUsers = $USERS;
$numberUsersCount = 0;
foreach $user (@data)
{
chop($user);
- YUPAPA CORRECTION - chomp $user;
($usernameCheck,$passwordCheck)=split(/\|/,$user);
if($usernameCheck eq $username)
{
print "Content-type: text/html\n\n";
print "<html><head><title>Webzter</title>\n";
print "<link rel=\"stylesheet\" href=\"http://ugz.milescape.com/css.css\" type=\"text/css\">\n";
print "</head>\n";
print "<body>\n";
print "<table width=\"100%\" height=\"100%\"><tr><td>\n";
print "<table width=\"500\" height=\"200\" style=\"border:2px solid Blask\"><tr><td>\n";
print "<b>Thank you for logging in $username, please <a href=\"users/".$username.".pl\">Click Here</a></b>\n";
print "</tr></td></table>\n";
print "</td></tr></table>\n";
print "</body></html>";
}
elsif($numberUsersCount == $numberUsers)
{
print "Content-type: text/html\n\n";
print "<html><head><title>Webzter</title>\n";
print "<link rel=\"stylesheet\" href=\"http://ugz.milescape.com/css.css\" type=\"text/css\">\n";
print "</head>\n";
print "<body>\n";
print "<table width=\"100%\" height=\"100%\"><tr><td>\n";
print "<table width=\"500\" height=\"200\" style=\"border:2px solid #616161\"><tr><td>\n";
print "<b>The username or password you entered seems to be incorrect. Please retry, if the problem persists, <a href=\"mailto:ln33\@iprimus.ca?subject=WebsiteLoginError\">please contact the administrator</a>.</b>\n";
print "</tr></td></table>\n";
print "</td></tr></table>\n";
print "</body></html>";
}
else
{
$numberUsersCount++;
}
}
#-/File and Username+Password Work--------------------#
And it threw an error... So thanx in advanced.
<edit> I fixed up some minor errors, probably still some more :) </edit>
I don't understand your coding... what does the password variable going to be used for? Your script doesn't check for the password. it only checks to see if the username is correct. Also, that is not how you get the number of user in the file...
u see:
open(USERS,"users.file") || die("An error has occurred, please contact the <a href=\"mailto:ln33\@iprimus.ca?subject=LogInError\">administrator</a>.");
@data=<USERS>;
close(USERS);
$numberUsers = $USERS;
Christopher
April 23rd, 2002, 13:00
Yeah, I was so wrapped up with the errors, I forgot to check for password :D
Anyway, I totally re-writed the script, now its this, if anyone is wondering (no errors!)
#!/usr/bin/perl
#-Form Processes--------------------------------------#
require "cgi-lib.pl";
&ReadParse(*input);
$username = $input{'username'};
$password = $input{'password'};
#-/Form Processes-------------------------------------#
#-File and Username+Password Work---------------------#
open(USERS,"users.pl") || die("An error has occurred, please contact the <a href=\"mailto:ln33\@iprimus.ca?subject=LogInError\">administrator</a>.");
@data=<USERS>;
close(USERS);
$found = "no";
foreach $user (@data)
{
chop($user);
($usernameCheck,$passwordCheck)=split(/\|/,$user);
if(($usernameCheck eq $username) && ($passwordCheck eq $password))
{
$found = "yes";
}
}
print "Content-type: text/html\n\n"; print "<html><head><title>Webzter</title>\n";
print "<link rel=\"stylesheet\" href=\"http://ugz.milescape.com/css.css\" type=\"text/css\">\n";
print "</head>\n";
print "<body>\n";
print "<table width=\"100%\" height=\"100%\"><tr><td>\n";
print "<center><table width=\"500\" height=\"200\" style=\"border:2px solid Blask\"><tr><td>\n";
if ($found eq "yes")
{
print "<center><b>Thank you for logging in $username, please <a href=\"../users/".$username.".pl\">Click Here</a> to continue.</b></center>\n";
}
else
{
print "<center><b>The username or password you entered seems to be incorrect. Please retry, if the problem persists, <a href=\"mailto:ln33\@iprimus.ca?subject=LogInError\">please contact the administrator</a>.</b></center>\n";
}
print "</center></tr></td></table>\n";
print "</td></tr></table>\n";
print "</body></html>";
#-/File and Username+Password Work--------------------#
Christopher
April 23rd, 2002, 13:33
Ok, LAST question, (for now :D) is there a way to run a Perl script of off a different server, but have it display on another server?
Ex. A perl counter script on my server, and show the number of people on the page - on a different server.
YUPAPA
April 23rd, 2002, 14:41
You can use socket... I think! :)
Christopher
April 23rd, 2002, 19:03
Sockets? Whatare they?
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.