#!/usr/bin/perl -w #!C:/xampp/perl/bin/perl -w # # This file is part of a HTML-CGI tutorial # # (C) Copyright 1999 Hans Kern # # File name : pldemo19.cgi # Created by : Hans Kern # Creation date: 31.3.99 # # This perl script tuto1.cgi sends an answer to # the client call of tuto1_post.htm or tuto1_get.htm # The answer is a HTML-document consisting of # a textfield that contains the information # send by the client but additionally enclosed in ***. # Required at Hochschule Karlsruhe: # 1) End-Of-Line must conform to UNIX-Standards. # UNIX: LF = 0A # PC: CR LF = 0D 0A # Mac: LF CR = 0A 0D # 2) The extension of the script must be .cgi # 3) The first line of the script must contain # the location of the perl interpreter. # #!C:/xampp/perl/bin/perl -w # 4) The script must be executable, not readable. # chmod 711 script # 5) The directory containing the script must # be readable and executable. # chmod 755 directory # 6) The script must produce a valid html-page. # Debugging at Hochschule Karlsruhe: # 1) Start the script in a desktop. # process data $rm = $ENV{'REQUEST_METHOD'}; if ( $rm eq "GET" ){ $qs = $ENV{'QUERY_STRING'}; } else { $cl = $ENV{'CONTENT_LENGTH'}; read (STDIN, $qs , $cl); } ($first, $second) = split (/&/, $qs); ($fieldName, $fieldValue) = split (/=/, $first); $qs = "***$fieldValue***"; # output data print "Content-type: text/html\n\n"; print ''; print ''; print 'Answer'; print ''; print ''; print '

Servers answer

'; print "

You requested this page with
". $ENV{HTTP_USER_AGENT} . "
"; print "by entering
". $ENV{HTTP_REFERER} . "\n

"; print "

first: ".$first." second: ".$second."\n

"; print "

fieldName: ".$fieldName." fieldValue: ".$fieldValue."\n

"; print '
'; print ""; print '
'; print ''; print '';