
June 2nd, 2000, 06:42 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Try <!--#include virtual="cgi-bin/news.cgi?action=new&id=22"-->
>>any way try with exec cmd directive also.
When using with cmd, the full server path needs to be specify.
<!--#exec cmd="/full/path/to/cgi-bin/news.cgi?action=new&id=22"-->
#############################################
Here is a quick example:
1)url.txt (newline n is the delimiter)
http://www.php.net/ http://www.apache.org/ http://www.perl.org/ http://www.devshed.com/
2) url.html
<html>
<body>
<!--#include virtual="news.cgi?action=new&id=2"-->
</body>
</html>
3) news.cgi
#!/usr/local/bin/perl
if ($ENV{'QUERY_STRING'}) {
@pairs = split(/&/, $ENV{'QUERY_STRING'});
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|n)*-->//g;
$value =~ s/<([^>]|n)*>//g;
$FORM{$name} = $value;
}
}
else {
print "Content-type: text/htmlnn";
print "Unknown Request!n";
exit;
}
if (($FORM{'action'} eq "new") && ($FORM{'id'} =~ /[0-9]/)) {
open(FILE, "url.txt");
@lines = <FILE>;
close(FILE);
chomp @lines;
print "Content-type: text/htmlnn";
print "<a href="$lines[$FORM{'id'}]">$lines[$FORM{'id'}]</a>n";
exit;
}
else {
print "Content-type: text/htmlnn";
print "Invalid String!n";
exit;
}
[This message has been edited by freebsd (edited June 02, 2000).]
[This message has been edited by freebsd (edited June 02, 2000).]
[This message has been edited by freebsd (edited June 02, 2000).]
|