Hi. The hosting company that I am with says that you only need "execute for
scripts" permissions to run Perl scripts in my cgi-bin directory. However,
I'm unable to run *any* of my scripts. Might anyone know why that may be?
Whenever I try to, I get a 403.1 Forbidden: Execute Access Forbidden. The
hosting company refuses to tell me how to get my scripts working, and cling
to this motto "We provide accessibility, not functionality." So, I have no
idea how to get my scripts going. Below is one of my many scripts that
simply won't run.

Thanks for your help
        Nick Hoffman



#!perl\perl.exe

use DBI;
use strict;
use CGI::Carp qw(fatalsToBrowser);

#data source name
my ($dsn) = "DBI:ODBC:ebahoops";

#for holding the username and password that the user entered
my (@username, @password);

#for holding the usernameS and passwordS in the pwd file
my (@unames, @pwds);

#whether the username and password exist AND match
my ($match) = "false";

#file that holds the different EBA divisions
my ($DivisionsFile) = "divisions.dat";
my (@division_contents);

#path to pwd file
my ($pwd_file) = "dont_delete.dat";

#for converting query string
my ($NameValue, $Name, $Value);

#array for holding query data
my (@data);

#database and statement handles
my ($dbh);
my ($sth);

#array for holding team names and numbers
my (@COEDTeamNames, @COEDTeamNums, @COEDDivisions);
my (@BoysTeamNames, @BoysTeamNums, @BoysDivisions);
my (@GirlsTeamNames, @GirlsTeamNums, @GirlsDivisions);

#temp vars
my (@temp, @params, $counter, $temp);

#put each param into the array
@params = split("&", $ENV {'QUERY_STRING'});

#convert ugly chars to regular chars
$counter = 0;
while (@params[$counter])
        {
        ($Name, $Value) = split("=", @params[$counter]);
        $Value =~ tr/+/ /;
        $Value =~ s/%([\dA-Fa-f][\dA-Fa-f])/ pack ("C", hex($1))/eg;
        @params[$counter] = $Name . "=" . $Value;

        $counter++;
        }

print <<HTMLSTUFF;
        <html>
        <head>

        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <meta name="description" content="The Official Etobicoke Basketball
Association's Web Page">
        <meta name="keywords" content="EBA, Etobicoke Basketball Association,
Basketball, League, BBall, Ball, Sport, Sports, fun, games, activity,
activities, net">

        <title>Etobicoke Basketball Association - Registration Form</title>
        </head>

        <body bgcolor="#FFFFFF" link="#FF0000" vlink="#FF0000" alink="#FF0000">

        <table border=0 cellpadding=0 cellspacing=0 width=600>
            <tr>
                <td valign="top" width="600">
                    <table border=0 cellpadding=0 cellspacing=0 width=100%>
                        <tr>
                                <td colspan=2>
                                                        <center>
                                        <table border=3 cellpadding=10 cellspacing=0>
                                                <tr>
                                                        <td>
                                                                <center>
                                                                <b>ETOBICOKE 
BASKETBALL ASSOCIATION</b><br>
                                                                <b>Administration 
Page</b>
                                                                </center>
                                                        </td>
                                                                </tr>
                                                        </table>
                                                        </center>
                                </td>
                        </tr>
                        <tr>
                                <td width=70%>&nbsp;</td>
                                <td width=30%>&nbsp;</td>
                        </tr>
HTMLSTUFF
;

if ((@params[0] !~ "username=") || (@params[1] !~ "password="))
        { #if the username or password isn't specified, ask for it
        print "
                                        <form action=\"edit_teams.pl\" method=\"get\">
                        <tr>
                                <td width=70%>Username:</td>
                                <td width=30%><input type=text size=12 maxlength=12
name=username></td>
                        </tr>
                        <tr>
                                <td width=70%>Password</td>
                                <td width=30%><input type=password size=12 maxlength=12
name=password></td>
                        </tr>
                        <tr>
                                <td width=70%>&nbsp;</td>
                                <td width=30%>&nbsp;</td>
                        </tr>
                        <tr>
                                <td colspan=2><center><input type=submit 
value=\"Submit\"
STYLE=\"background:AD5100\"><center></td>
                                                </form>
                                        </tr>
                                </table>
        ";
        }
else
        {
        #split up the username
        @username = split("=", @params[0]);
        @password = split("=", @params[1]);

        #encrypt the password
        @password[2] = crypt(@password[1], "fish");

        #grab the usernames and passwords from the pwd file
        open (pwd, $pwd_file) || die print "Error while opening pwd file for
reading:<br>$!<br>";
                @temp = <pwd>;
        close pwd;

        #build the uname and pwd arrays
        $counter = 0;
        while ((@temp[$counter]) && ($match eq "false"))
                {
                (@unames[$counter], @pwds[$counter]) = split (",", @temp[$counter]);

                #get rid of the end-of-line char from the pwd
                chomp(@pwds[$counter]);

                if ((@username[1] eq @unames[$counter]) && (@password[2] eq
@pwds[$counter]))
                        {$match = "true";}

                $counter++;
                }

        if ($match eq "false")
                {
                print "
                        <tr>
                                <td colspan=2>
                                        <b><font color=red><center>
                                        ERROR: the username and password do not match
                                        </center></font></b>
                                </td>
                        </tr>
                        </table>
                        ";
                }
        else #the username and password match
                {
                if (@username[1] eq "admin")
                        {
                        print "
                                <tr><td width=100%><b><font size=+1>Team 
Editing</font></b></td></tr>
                                <tr><td width=100%><font size=-1>You are logged in as 
the
administrator.</font></td></tr>
                                <tr><td width=100%>&nbsp;</td></tr>
                                <tr><td width=100%>
                                ";

                        #get all of the existing teams

                        #***Connect to the database***
                        $dbh = DBI->connect($dsn, "", "") || die print 
"$DBI::errstr<hr>";

                        #***Extract the teams from the database
                        $sth = $dbh->prepare("SELECT TeamNum, TeamName, Division FROM 
Teams WHERE
Gender=? ORDER BY Gender, Division, TeamName")  || die print "Died while
preparing:<br>$DBI::errstr<hr>";

                        #execute for CO-ED and retrieve the data
                        $sth->execute('CO-ED') || die print "Died while
executing:<br>$DBI::errstr<hr>";
                        $counter = 0;
                        while (@data = $sth->fetchrow_array())
                                {
                                @COEDTeamNums[$counter] = @data[0];
                                @COEDTeamNames[$counter] = @data[1];
                                @COEDDivisions[$counter] = @data[2];
                                $counter++;
                                }

                        #execute for Boys and retrieve the data
                        $sth->execute('Boys') || die print "Died while
executing:<br>$DBI::errstr<hr>";
                        $counter = 0;
                        while (@data = $sth->fetchrow_array())
                                {
                                @BoysTeamNums[$counter] = @data[0];
                                @BoysTeamNames[$counter] = @data[1];
                                @BoysDivisions[$counter] = @data[2];
                                $counter++;
                                }

                        #execute for Girls and retrieve the data
                        $sth->execute('Girls') || die print "Died while
executing:<br>$DBI::errstr<hr>";
                        $counter = 0;
                        while (@data = $sth->fetchrow_array())
                                {
                                @GirlsTeamNums[$counter] = @data[0];
                                @GirlsTeamNames[$counter] = @data[1];
                                @GirlsDivisions[$counter] = @data[2];
                                $counter++;
                                }

                        if ((@COEDTeamNums == 0) && (@BoysTeamNums == 0) && 
(@GirlsTeamNums ==
0)) #no teams currently exist
                                { #make sure at least 1 team exists
                                print "
                                        No teams currently exist.<p>
                                        <table border=0 cellpadding=4 cellspacing=0 
width=100%>
                                        ";
                                }
                        else
                                { #at least 1 team exists, so let's display them
                                print "
                                        <table border=0 cellpadding=4 cellspacing=20 
width=100%>
                                                <tr>
                                                        <td 
bgcolor=AD5200><b>CO-ED</b></td>
                                                        <td 
bgcolor=AD5200><b>Boys</b></td>
                                                        <td 
bgcolor=AD5200><b>Girls</b></td>
                                                </tr>
                                                <tr>
                                                        <td bgcolor=AD5200 valign=top>
                                                                <table border=0 
cellpadding=4 cellspacing=0>
                                                                        <tr>
                                                                                <td 
bgcolor=AD5200 width=50%><b>Name</b></td>
                                                                                <td 
bgcolor=AD5200 width=50%><b>Division</b></td>
                                                                        </tr>
                                        ";

                                $counter = 0;
                                while (@COEDTeamNums[$counter])
                                        {
                                print "                 <tr>
                                                                        <td 
bgcolor=AD6200 width=50%>@COEDTeamNames[$counter]</td>
                                                                        <td 
bgcolor=AD6200 width=50%>@COEDDivisions[$counter]</td>
                                                                </tr>";
                                $counter++;
                                        } #end while
                                print "                 </table>
                                                        </td>
                                                        <td bgcolor=AD5200 valign=top>
                                                                <table border=0 
cellpadding=4 cellspacing=0>
                                                                        <tr>
                                                                                <td 
bgcolor=AD5200><b>Name</b></td>
                                                                                <td 
bgcolor=AD5200><b>Division</b></td>
                                                                        </tr>
                                                        ";

                                $counter = 0;
                                while (@BoysTeamNums[$counter])
                                        {
                                print "                 <tr>
                                                                        <td 
bgcolor=AD6200>@BoysTeamNames[$counter]</td>
                                                                        <td 
bgcolor=AD6200>@BoysDivisions[$counter]</td>
                                                                </tr>";
                                $counter++;
                                        } #end while

                                print "                 </table>
                                                        </td>
                                                        <td bgcolor=AD5200 valign=top>
                                                                <table border=0 
cellpadding=4 cellspacing=0>
                                                                        <tr>
                                                                                <td 
bgcolor=AD5200><b>Name</b></td>
                                                                                <td 
bgcolor=AD5200><b>Division</b></td>
                                                                        </tr>
                                                        ";

                                $counter = 0;
                                while (@GirlsTeamNums[$counter])
                                        {
                                print "                 <tr>
                                                                        <td 
bgcolor=AD6200>@GirlsTeamNames[$counter]</td>
                                                                        <td 
bgcolor=AD6200>@GirlsDivisions[$counter]</td>
                                                                </tr>";
                                $counter++;
                                        } #end while

                                print "                 </table>
                                                        </td>
                                                </tr>
                                                </table>
                                        </td>
                                </tr>
                                        ";

                                print "
                                <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                </tr>
                                <tr>
                                        <td>&nbsp;</td>
                                        <td>&nbsp;</td>
                                </tr>
                                <tr>
                                        <td colspan=2>
                                                <table border=0 cellpadding=4 
cellspacing=0 width=100%>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD5200>
                                                                        <form 
action=\"rename_a_team.pl\" method=\"get\">
                                                                        <input 
type=hidden name=username value=@username[1]>
                                                                        <input 
type=hidden name=password value=@password[1]>

                                                                        <b>Rename A 
Team</b>
                                                                </td>
                                                                <td width=40% 
bgcolor=AD5200>&nbsp;</td>
                                                                <td width=20% 
bgcolor=AD5200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD5200>&nbsp;&nbsp;&nbsp;&nbsp;Current Team
Name:</td>
                                                                <td width=40% 
bgcolor=AD5200><input type=text size=20 maxlength=50
name=CurrentTeamName></td>
                                                                <td width=20% 
bgcolor=AD5200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD5200>&nbsp;&nbsp;&nbsp;&nbsp;New Team
Name:</td>
                                                                <td width=40% 
bgcolor=AD5200><input type=text size=20 maxlength=50
name=NewTeamName></td>
                                                                <td width=20% 
bgcolor=AD5200><input type=submit
value=\"Submit\"></td>
                                                                </form>
                                                        </tr>
                                                        <tr>
                                                                <td 
bgcolor=AD5200>&nbsp;</td>
                                                                <td 
bgcolor=AD5200>&nbsp;</td>
                                                                <td 
bgcolor=AD5200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td 
bgcolor=AD6200>&nbsp;</td>
                                                                <td 
bgcolor=AD6200>&nbsp;</td>
                                                                <td 
bgcolor=AD6200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD6200>
                                                                        <form 
action=\"delete_a_team.pl\" method=\"get\">
                                                                        <input 
type=hidden name=username value=@username[1]>
                                                                        <input 
type=hidden name=password value=@password[1]>

                                                                        <b>Delete A 
Team</b>
                                                                </td>
                                                                <td width=40% 
bgcolor=AD6200>&nbsp;</td>
                                                                <td width=20% 
bgcolor=AD6200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD6200>&nbsp;&nbsp;&nbsp;&nbsp;Team Name:</td>
                                                                <td width=40% 
bgcolor=AD6200><input type=text size=20 maxlength=50
name=TeamName></td>
                                                                <td width=20% 
bgcolor=AD6200><input type=submit
value=\"Submit\"></td>
                                                                </form>
                                                        </tr>
                                                        <tr>
                                                                <td 
bgcolor=AD6200>&nbsp;</td>
                                                                <td 
bgcolor=AD6200>&nbsp;</td>
                                                                <td 
bgcolor=AD6200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td 
bgcolor=AD5200>&nbsp;</td>
                                                                <td 
bgcolor=AD5200>&nbsp;</td>
                                                                <td 
bgcolor=AD5200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD5200>
                                                                        <form 
action=\"add_a_game.pl\" method=\"get\">
                                                                        <input 
type=hidden name=username value=@username[1]>
                                                                        <input 
type=hidden name=password value=@password[1]>

                                                                        <b>Add A 
Game</b>
                                                                </td>
                                                                <td width=40% 
bgcolor=AD5200>&nbsp;</td>
                                                                <td width=20% 
bgcolor=AD5200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD5200>&nbsp;&nbsp;&nbsp;&nbsp;Team Name:</td>
                                                                <td width=40% 
bgcolor=AD5200><input type=text size=20 maxlength=50
name=Team1Name></td>
                                                                <td width=20% 
bgcolor=AD5200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD5200>&nbsp;&nbsp;&nbsp;&nbsp;Team Name:</td>
                                                                <td width=40% 
bgcolor=AD5200><input type=text size=20 maxlength=50
name=Team2Name></td>
                                                                <td width=20% 
bgcolor=AD5200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD5200>&nbsp;&nbsp;&nbsp;&nbsp;Date
(DD/MM/YY):</td>
                                                                <td width=40% 
bgcolor=AD5200><input type=text size=20 maxlength=8
name=Date></td>
                                                                <td width=20% 
bgcolor=AD5200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD5200>&nbsp;&nbsp;&nbsp;&nbsp;Time:</td>
                                                                <td width=40% 
bgcolor=AD5200><input type=text size=20 maxlength=20
name=Time></td>
                                                                <td width=20% 
bgcolor=AD5200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD5200>&nbsp;&nbsp;&nbsp;&nbsp;Location:</td>
                                                                <td width=40% 
bgcolor=AD5200><input type=text size=20 maxlength=255
name=Location></td>
                                                                <td width=20% 
bgcolor=AD5200><input type=submit
value=\"Submit\"></td>
                                                                </form>
                                                        </tr>
                                                        <tr>
                                                                <td 
bgcolor=AD5200>&nbsp;</td>
                                                                <td 
bgcolor=AD5200>&nbsp;</td>
                                                                <td 
bgcolor=AD5200>&nbsp;</td>
                                                        </tr>
                                ";
                                } #end else: there's at least 1 team

                        print "
                                                        <tr>
                                                                <td 
bgcolor=AD6200>&nbsp;</td>
                                                                <td 
bgcolor=AD6200>&nbsp;</td>
                                                                <td 
bgcolor=AD6200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD6200>
                                                                        <form 
action=\"add_a_team.pl\" method=\"get\">
                                                                        <input 
type=hidden name=username value=@username[1]>
                                                                        <input 
type=hidden name=password value=@password[1]>

                                                                        <b>Add A 
Team</b>
                                                                </td>
                                                                <td width=40% 
bgcolor=AD6200>&nbsp;</td>
                                                                <td width=20% 
bgcolor=AD6200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD6200>&nbsp;&nbsp;&nbsp;&nbsp;New Team's
Name:</td>
                                                                <td width=40% 
bgcolor=AD6200><input type=text size=20 maxlength=50
name=NewTeamName></td>
                                                                <td width=20% 
bgcolor=AD6200>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                                <td width=40% 
bgcolor=AD6200>&nbsp;&nbsp;&nbsp;&nbsp;New Team's
Division:</td>
                                                                <td width=40% 
bgcolor=AD6200>
                                ";

                        #print the divisions, but without the cost
                        open (divisions, $DivisionsFile) || die print "Error while 
opening
divisions file for reading:<br>$!<br>";
                                @division_contents = <divisions>;
                        close divisions;

                        chomp (@division_contents);

                        foreach $_ (@division_contents)
                                {
                                #only grab entries that start with C, B or G
                                #this gets rid of the "--Select--" and "- - - - - -" 
entries
                                if (/select /)
                                        {print "$_\n";}
                                elsif (/select_one/)
                                        {}
                                else #it's an <option> that we want
                                        {
                                        /(<.*?>.*):.*(<.*?>)/;

                                        print "\t\t\t\t\t$1$2\n";
                                        }
                                }

                        print "
                                                                        </select>
                                                                </td>
                                                                <td 
bgcolor=AD6200><input type=submit value=\"Submit\"></form></td>
                                                </table>
                                        </td>
                                </tr>
                                ";

                        $dbh->disconnect();
                        } #end if username == "admin"
                else
                        {
                        print "
                                <tr>
                                        <td colspan=2>
                                                <b><font color=red><center>
                                                ERROR: you are not allowed access to 
this page
                                                </center></font></b>
                                        </td>
                                </tr>
                                </table>
                                ";
                        }
                }
        } #end else

print <<HTMLSTUFF;
                                <tr>
                                        <td colspan=2>
                                                &nbsp;<p>
                                                <form action="edit_teams.pl" 
method="get">
                                                        <input type=hidden 
name=username value=@username[1]>
                                                        <input type=hidden 
name=password value=@password[1]>
                                                        <input type="Submit" 
value="Reload Page">
                                                </form>
                                        </td>
                                </tr>
                        </td>
                </tr>
        </table>
        </body>
        </html>

HTMLSTUFF
;

Reply via email to