if (condition} =~ /$pattern/)
{
<!--#include file="/myfile.html" -->
}
else {
<!--#include file="/myotherfile.html" -->
}
If I can't embed the ssi calls like this, how else could I accomplish the same thing?
#!/usr/bin/perl
#<!--#include virtual="/mytester.cgi"-->
$file1 ="/path/to/file/one";
$file2 ="/path/to/file/two";
if ($ENV{'HTTP_USER_AGENT'} =~ /googlebot/i) {
$ifile =$file1;
}
else {
$ifile =$file2;
}
open FILE, $ifile;
@o=<FILE>;
close FILE;
foreach (@o) {
print $_;
}
For instance, some of my pages are cloaked and some aren't, it's easy to use SSI on the uncloaked pages, but I haven't figured out how to use an include on a cloaked page. Using ICS I can only have one include on the main page which then directs a visitor or spider a predefined page. Since I can't put SSI in the main cloaked page, and it doesn't work when I put it in the "human version" of the same page...what now?
I've tried adding an absolute path and also putting a copy of the page.html that I'm trying to include in the "human version"...I'm lost.
E.g., a typical CGI script might say "Sorry, but dsafdsadsa@dasfdsa is not a valid email address." What do you think would happen if somebody typed in some SSI for their email address, perhaps with a mind to delete files from your server? That script would output it in the HTML, which would then get run by the SSI engine... eeeek!
The solution: make your CGI program do everything all by itself. Whatever job the SSI is suppose to accomplish, your CGI program can accomplish it to. After all, it's generating all of the other output, why not generate those last few bits?
Bolotomus