[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgi-list
Subject:    [CGI] Malformed head from script
From:       Kelly Biernaskie <kelly () csgm ! com>
Date:       1997-07-28 20:15:21
[Download RAW message or body]

I dont get it at all. Here's the code maybe someone out there can tell me
what I'm doing wrong....

-------------------------------------------------Code
Follows----------------------------------------------------

#!/usr/bin/perl
print "Content-type:text/html\n\n";


####################################################
# Initialize variables
####################################################

$form_origin="null";
$data="null";
$access_flag="false";

####################################################
# get the data that valid2.cgi passed along
####################################################

read (STDIN,$data,$ENV{'CONTENT_LENGTH'});

####################################################
# split the info passed from valid2.cgi into seperate
# variables for testing
####################################################

($name,$value)=split(/=/,$data);

####################################################
# open the file valid3.dat to get data before
# the login process can begin. Place the values
# into array @admin_pass
####################################################

open (ADMINPWD, "/usr/local/etc/httpd/cgi-bin/catalog/kelly/valid3.dat");
@admin_pass=<ADMINPWD>;
close (ADMINPWD);

####################################################
# split the info passed from valid2.cgi into seperate
# variables for processing
####################################################

($surfer_name,$form_origin)=split(/=/,$data);

####################################################
# Start foreach loop so each element in the array
# gets processed to see if they match $surfer_name
# chop off the last character from $admin_name to
# get rid of carriage returns
####################################################

foreach $admin_name(@admin_pass){
chop($admin_name);

####################################################
# Test to see if $admin_name is not equal to 
# $surfer_name, if it isn't then set $access_flag
# to false
####################################################

if ($admin_name ne $surfer_name)
{
$access_flag="false";
}

####################################################
# if $admin_name does equal $surfer_name then 
# execute the following code
####################################################

else
{
$access_flag="true";

####################################################
# Start print function
####################################################

print<<print_tag;
        <html>
        <head>
        <title>Access Granted - Please Login</Title>
        </head>
        <body>
        <h1>Access Granted - Please Login</h1>
        <hr>
        <br>
        <form method=post action="/cgi-bin/catalog/kelly/valid4.cgi">
        <input type="hidden" name="$name" value="$value">
        <input type="submit" value="Start Login Process">
        </form>
        <hr>
        </body>
        </html>
print_tag
exit();
}
}

####################################################
# End print function and then exit the script.
# End foreach loop and else statement
####################################################

####################################################
# Start print function
####################################################

print<<print_tag;
        <html>
        <head>
        <title>Authorization Area One</title>
        </head>
        <body>
        <center><h2>Access Denied</h2></center>
        <br>
        <hr>
        <br>
        <center><h3>Contact your system administrator for
authorization</h3></center>
        <hr>
        <form action="/cgi-bin/catalog/kelly/valid1.cgi">
        <input type="submit" value="return to main">
        </form>
        </body>
        </html>
print_tag

####################################################
# End print function
####################################################

			You are In my Thoughts

			            Kelly 
------------------------------------------------------------------------------
To unsubscribe from the CGI Digest, mailto:majordomo@jann.com with
the words "UNSUBSCRIBE cgi-list" in the message body.

SUPPORT YOUR NEW LIST, POST TO IT at mailto:cgi-list@JANN.COM

To contact a person at the CGI list, mailto:owner-cgi-list@jann.com

cgi-list is hosted by Wizards of the Web (http://wizweb.com).
------------------------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic