LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author]
  From: Paul Schulz <pauls@CAEmrad.com.au>
  To  : daved@uq.net.au, linuxsa@linuxsa.org.au
  Date: Wed, 26 Apr 2000 13:36:33 +0930

Re: cgi prob.

You need a line like the following:

  echo "Content-type: text/html"
  echo 

when producing your http header for the browser..  This header
finishes at the first blank line (and isn't part of the displayed
page).  Try running your script at a shell prompt to check that you
don't have any other undesired blank lines, and that you get the
desired output.

PaulS

  BA> I have a cgi script on my webserver that checks the access-log
  BA> for httpd and reformats it a bit before displaying the results
  BA> as an html file.

  BA> The problem is, although the script "loads" the webpage, it
  BA> doesn't run the script to build the webpage. Thus, I want to
  BA> know is, why isn't it working?  What stupid thing have I
  BA> done/overlooked?

  BA> (see scripts included below)

  BA> Thanks, Dave.


  BA> [http_access.cgi]--------------------------------------------------
  BA> #!/bin/sh

  BA> rm -f /home/httpd/html/checkaccess.html /bin/sh build_access
  BA> echo Location: http://eric.viking.org.au/checkaccess.html echo
  BA> -------------------------------------------------------------------

  BA> [build_access]-----------------------------------------------------
  BA> #!/bin/sh

  BA> rm -f /home/httpd/html/checkaccess.html touch
  BA> /home/httpd/html/checkaccess.html echo '<HTML><HEAD><META
  BA> http-equiv="Pragma" content="no-cache"></HEAD><BODY>' >
  BA> /home/httpd/html/checkaccess.html echo '<H1>Machine access to
  BA> eric.viking.org.au</H1>' >> /home/httpd/html/checkaccess.html
  BA> echo '<p>' >> /home/httpd/html/checkaccess.html date >>
  BA> /home/httpd/html/checkaccess.html echo '<p>' >>
  BA> /home/httpd/html/checkaccess.html /bin/sh ./ha.sh cat
  BA> /tmp/ha.txt | awk -f ha.awk >> /home/httpd/html/checkaccess.html
  BA> -------------------------------------------------------------------

  BA> [ha.sh]------------------------------------------------------------
  BA> #!/bin/sh

  BA> cat /var/log/httpd/access_log | cut -d " " -f 1 | sort | uniq \
  >> /tmp/ha.txt

  BA> cat /tmp/ha.txt | nslookup > /tmp/hanames.txt
  BA> -------------------------------------------------------------------

  BA> [ha.awk]-----------------------------------------------------------
  BA> { printf("%s <br>\n", $1) }
  BA> -------------------------------------------------------------------

-- 
Paul Schulz(pauls@caemrad.com.au) - 8260 8170                 SysAdmin
CAE MRad, Innovation House West, First Avenue, TECHNOLOGY PARK SA 5095
-..-.----_...._--..._---_.-----.....---___.,-..----.-,---.-.--__._....

-- 
LinuxSA WWW: http://www.linuxsa.org.au/  IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author]
Return to the LinuxSA Mailing List Information Page