[100337] in RedHat Linux List

home help back first fref pref prev next nref lref last post

Apache web server scripts &

daemon@ATHENA.MIT.EDU (aromes@microtec.net)
Fri Nov 20 00:01:37 1998

From: aromes@microtec.net
Date: Fri, 20 Nov 1998 00:15:29 -0800
To: redhat-list-request@redhat.com
Cc: linux-admin@vger.rutgers.edu, redhat-list@redhat.com
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com

Hi,
On my Apache web server, I ve created this little index.html 
script:
<HTML>
<HEAD><TITLE>My web page</TITLE></HEAD>
<BODY>
<P>
<FORM ACTION= /home/httpd/cgi-bin/query.pl METHOD=POST>
Enter Your name:
<INPUT TYPE= TEXT NAME= USERNAME SIZE= 25 MAXLEGTH= 50
VALUE= >
</P>
</FORM>
</BODY>
</HTML>
Now, with my browser, Lynx, I can see a Nice entry that asks me
to enter a Username, of course.
So, I went picking up a username on the fly and press enter.
Of course, My browser wont reply..probably because that username
I entered is strange to him. And here comes my question:
Say. I want to be able to enter a username called "spike"
for ie..and being able to get an output..or something to go around.
I guess I should create a cgi script file with the entry
"spike" mentionned somewhere..could anyone write a little quick cgi script
that can make that work..just to get the idea.
Cause what I mainly want  is to have my script responding with
with search results based on keyword "spike". As it;s a beginning, a little
script will help ..just to get the concept.
Well, I ve created following /home/httpd/cgi-bin/query.pl file, 
but it seems full of errors cause my html form seems not to cooperate with it:
#Contents of /home/httpd/cgi-bin/query.pl
if ($ENV {REQUEST_METHOD } ne POST ) {
	&send_error_page( Page was not accessed with POST operation. );
sub remove_escapes {
	local ($line) = @_;
	#You can try $line=$QUERY_STRING
	#First, change pluses (+) to spaces
	$line =~ s/\+/\ /g;
	#Then convert %XX values from hex to regular characters
	$line =~ s/%(..)pack( c,hex($1)) /ge;
	return( $line );
@name_value_pairs = split( /&/ , $ENV( QUERY_STRING );
foreach $pair ( @name_value_pairs ) {
	($name,$value) = split( /=/,pair );
require cgi-lib.pl;
&ReadParse;
<P>
Your First Name : <INPUT TYPE= TEXT NAME= USERNAME>
<P>
Print Thank you, $in{ first_name }, for submitting your comments. ;
print <<EOF;
Content-type: text/html

Marc


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
		http://www.redhat.com http://archive.redhat.com
         To unsubscribe: mail redhat-list-request@redhat.com with 
                       "unsubscribe" as the Subject.


home help back first fref pref prev next nref lref last post