Link to home
Start Free TrialLog in
Avatar of Gimpster
Gimpster

asked on

Problems with CGI script

Here is the CGI script I am working on.  I have run it through the PERL Syntax checker and it gives me errors on the 'print <<"...";' statements, the 'exit;' statement, and the closing '}'.  I was wondering if you could tell me why?  Thanks!

#!/usr/bin/perl

require "subparseform.lib";
&Parse_Form;

$uid = $formdata{'uid'};
$pwd = $formdata{'pwd'};

use Win32::ODBC;

$db = new Win32::ODBC("DSN=CPCustomDB;UID=$uid;PWD=$pwd") || &Failed_Login;

######################
#start error routine for login
######################
Sub Failed_Login {

print "Content-type: text/html\n\n";
print <<"Failed Login";

<HTML>
<HEAD>
<TITLE>Failed Login</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<TABLE BORDER=0 WIDTH=600 CELLSPACING=0 CELLPADDING=0>
      <TR>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=125 BGCOLOR=#4682B4> </TD>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=25 BGCOLOR=#FFFFFF> </TD>
            <TD ALIGN=LEFT VALIGN=TOP WIDTH=450 BGCOLOR=#FFFFFF> </TD>
      </TR>
</TABLE>
<TABLE BORDER=0 WIDTH=600 CELLSPACING=0 CELLPADDING=0>
      <TR>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=125 BGCOLOR=#4682B4> </TD>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=25 BGCOLOR=#FFFFFF> </TD>
            <TD ALIGN=LEFT VALIGN=TOP WIDTH=450 BGCOLOR=#FFFFFF>
                  <FONT FACE="Times" SIZE=+4 COLOR=TAN><CENTER><B>The Computer Place</B></CENTER></FONT>
                  <FONT SIZE=+1><CENTER>Intranet Database</CENTER></FONT><BR>
                  <P> 
                  <P><FONT FACE="Helvetica" COLOR="Red" SIZE="6"><CENTER><STRONG>ERROR!</STRONG></CENTER></FONT>
                  <P><FONT SIZE=3><STRONG>The server encoutered an error when trying to log you into the database using the username and password that you supplied.  Please check your username and password and try again.  Otherwise, please contact the database administrator.</STRONG></FONT>
                  <P><CENTER><FORM ACTION="http://domain.name/index.html"><INPUT TYPE="Submit" NAME="Go Back" VALUE="<<  Go Back"></FORM></CENTER>
            </TD>
      </TR>
</TABLE>
<TABLE BORDER=0 WIDTH=600 CELLSPACING=0 CELLPADDING=0>
      <TR>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=125 BGCOLOR=#4682B4> </TD>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=25 BGCOLOR=#FFFFFF> </TD>
            <TD ALIGN=LEFT VALIGN=BOTTOM WIDTH=450 BGCOLOR=#FFFFFF><FONT COLOR="tan"><STRONG> </STRONG></FONT></TD>
      </TR>
</TABLE>
</BODY>
</HTML>

Failed Login
exit;
}
######################
#end error routine for login
######################

##################
#start normal display
##################
print "Content-type: text/html\n\n";

print<<"Form Layout";

<HTML>
<HEAD>
<TITLE>Table Selection</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<TABLE BORDER=0 WIDTH=600 CELLSPACING=0 CELLPADDING=0>
      <TR>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=125 BGCOLOR=#4682B4> </TD>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=25 BGCOLOR=FFFFFF> </TD>
            <TD ALIGN=LEFT VALIGN=TOP WIDTH=450 BGCOLOR=FFFFFF> </TD>
      </TR>
</TABLE>
<TABLE BORDER=0 WIDTH=600 CELLSPACING=0 CELLPADDING=0>
      <TR>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=125 BGCOLOR=#4682B4> </TD>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=25 BGCOLOR=FFFFFF> </TD>
            <TD ALIGN=LEFT VALIGN=TOP WIDTH=450 BGCOLOR=FFFFFF>
                  <FONT FACE="Times" SIZE=+4 COLOR=TAN><CENTER><B>The Computer Place</B></CENTER></FONT>
                  <FONT SIZE=+1><CENTER>Intranet Database</CENTER></FONT><BR>
                  <P> 
                  <P>Please select the table you wish to view from the list below.
                  <P><FORM ACTION=http://domain.name/cgi-bin/tableselection.cgi METHOD=POST ID=tableredirect>

Form Layout

                        print "<INPUT TYPE=\"Hidden\" NAME=\"uid\" VALUE=$uid>";
                        print "<INPUT TYPE=\"Hidden\" NAME=\"pwd\" VALUE=$pwd>";

print<<"Form Layout";

                        <INPUT TYPE=\"Radio\" NAME=\"table\" ID=\"customers\">Customer Table<BR>
                        <INPUT TYPE=\"Radio\" NAME=\"table\" ID=\"inventory\">Inventory List<BR>
                        <P><CENTER><INPUT TYPE=\"Submit\" NAME=\"Submit\" VALUE=\"Continue\"></CENTER>
            </TD>
      </TR>
</TABLE>
<TABLE BORDER=0 WIDTH=600 CELLSPACING=0 CELLPADDING=0>
      <TR>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=125 BGCOLOR=#4682B4> </TD>
            <TD ALIGN=CENTER VALIGN=TOP WIDTH=25 BGCOLOR=FFFFFF> </TD>
            <TD ALIGN=LEFT VALIGN=BOTTOM WIDTH=450 BGCOLOR=FFFFFF><FONT COLOR=\"tan\"><STRONG><P> <P> <P> <P> </STRONG></FONT></TD>
      </TR>
</TABLE>
</BODY>
</HTML>

Form Layout
#################
#end normal display
#################
Avatar of Gimpster
Gimpster

ASKER

Edited text of question.
Adjusted points to 110
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial