Newsgroup: it.comp.www.html
Titolo: apache e cgi

\n"; } 
print MAIL "Subject: $subject\n"; 
print MAIL "\n"; 
print MAIL "This message was sent through the quick emailer by Gabriel Schine.\n"; 
print MAIL "--  Message:\n"; 
print MAIL "$body"; 
print MAIL "\n--"; 
 
close (MAIL); 
 
# we're done 
 
# now we print out the nice thank you note... 
 
print "<title>Thank you, $name</title>"; 
print "<h1>Thank you, $name</h1>"; 
print "<hr>Thank you for your comments."; 
 
*********************************************************** 
 
e questo è il file di riferimento tom .pl 
 
************************************************************ 
 
#!/usr/bin/perl 
 
############################################################ 
# 
gabe-lib.pl
: by Gabriel Schine 
#	please use and distribute as you wish, 
#	just don't change anything or take credit for it. 
# 
#	version: 1.0 
############################################################ 
 
############################################################ 
# ParseForm 
#	a very simple form parsing function. 
#	it will parse both POST and GET types, and return all 
#	the data in %data. you can use $data, and @data if 
#	you want. 
############################################################ 
 
 
sub ParseForm{ 
 
	local($get_meth) = $ENV{'REQUEST_METHOD'}; 
	if ($get_meth eq "POST") 
	{ 
		$data = <STDIN>; 
		chomp $data; 
	} elsif ($get_meth eq "GET") 
	{ 
		$data = $ENV{'QUERY_STRING'}; 
	} else { DoErr("Unknown request method: $get_meth"); } 
 
	@data = split("&",$data); 
 
	foreach $i (0..$#data) 
	{ 
		$data[$i] =~ s/\+/ /g; 
		local($name,$value) = split('=',$data[$i]); 
		$name =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; 
		$value =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; 
 
		if (defined $data{$name}) 
		{ 
			$data{$name} .= "\0" . $value 
		} else { $data{$name} = $value } 
	} 
 
} 
 
############################################################ 
# DoErr 
#	very simple error function, use it to display an 
#	HTML error. Pass it a string or multiple strings 
############################################################ 
 
sub DoErr { 
	print "Content-type: text/html\n\n"; 
	print "<HTML><HEAD><TITLE>$_[0]</TITLE></HEAD>\n"; 
	print "<BODY><H1>$_[0]</H1>\n"; 
	foreach $i (1..$#_) 
	{ 
		print $_[$i],"<BR>\n"; 
	} 
	print "</BODY></HTML>"; 
	die $_[0]; 
} 
 
# PrintHead prints the Content-type: bla bla  for your page. pass it 
#	the content type that your cgi will be returning. 
#	if you pass it nothing, it will default to text/html 
 
sub PrintHead 
{ 
	if (!$_[0]) { $_[0] = "text/html"; } 
	print "Content-type: $_[0]\n\n"; 
} 
 
# RedirectBrowser is used to redirect the browser to a page. The page you 
#	pass it must be in a full URL. Otherwise the browser will not 
#	understand it. 
 
sub RedirectBrowser 
{ 
	local($url) = $_[0]; 
	print "Location: $url\n\n"; 
} 
 
 
# must return a 1 
1; 
 
*************************************************** 
 
e infine questa è la pagina html 
 
***************************************************** 
HTML> 
<BR><BR> 
<center> 
<FORM ACTION="cgi-bin/
emailer.pl
" method=POST> 
 <input type=hidden name="address" value="tommaso@localhost"> 
 Name: <input type=text name="name"><BR> 
 Email: <input type=text name="email"><BR> 
 Subject: <input type=text name="subject"><BR> 
 Message:<BR> 
 <textarea rows=5 cols=50 name="body"> 
 </textarea> 
 <BR> 
 <input type=submit value="Send"> 
</form> 
</center></HTML> 
 
 
*********************** 
 
 
aiutatemi!!!!!!!!!!!!! 
 
 
ivi...@tin.it
 
 
 
grazie 
 
p.s. ho modificato i file di perl con chmod 755 

...

