From owner-freebsd-questions Thu Aug 5 10:37: 9 1999 Delivered-To: freebsd-questions@freebsd.org Received: from mail.rdc1.md.home.com (ha1.rdc1.md.home.com [24.2.2.66]) by hub.freebsd.org (Postfix) with ESMTP id B5A83155C6 for ; Thu, 5 Aug 1999 10:37:06 -0700 (PDT) (envelope-from mujtaba@bitsmart.com) Received: from mujtaba ([24.3.26.31]) by mail.rdc1.md.home.com (InterMail v4.01.01.00 201-229-111) with ESMTP id <19990805173605.HIQL9930.mail.rdc1.md.home.com@mujtaba>; Thu, 5 Aug 1999 10:36:05 -0700 From: "Mujtaba Ali" To: Cc: Subject: Perl/SSI hacking Date: Thu, 5 Aug 1999 13:35:54 -0400 X-MSMail-Priority: Normal X-Priority: 3 X-Mailer: Microsoft Internet Mail 4.70.1155 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-Id: <19990805173605.HIQL9930.mail.rdc1.md.home.com@mujtaba> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello all, I couldn't find an Apache mailing list on www.apache.org, so I thought I'd post this question here (it could have something to do with FreeBSD's environment variable handling) and see if anyone can help out. I already tried alt.perl and another perl newsgroup. I apologize if this is not in the scope of this mailing list. Basically, here is an index.shtml (SSI-enabled) file: Here is test.pl: #!/usr/local/bin/perl print "Content-type: image/gif\n\n"; # ---- Debug code ---- open (TEMP, ">temp.txt"); while (($key, $val) = each %ENV) { print TEMP "$key = $val
\n"; } close TEMP; # -------------------- if ($ENV{'IMAGE_PROTECTION_CODE'} eq "43\@3!ERT") { open (IMAGE, "can't_get_me.gif") or die "$!"; } else { open (IMAGE, "dummy.gif") or die "$!"; } print ; close IMAGE; Problem is that the Perl script can't access the variable set by the SSI SET command (in the index.shtml file) becuase it has a different environment space (at least that's my thinking). If I had called the script using an SSI INCLUDE or EXEC command, it would have no problem seeing $ENV{'IMAGE_PROTECTION_CODE'}. Basically, is there any hack I can employ to get this variable from mod_include through the Perl script? (I hope that makes sense.) Or, is there a better way to do this? The purpose of this setup is of course to implement rudimentary image "protection". I am just doing this as an exercise/project. I understand someone could still get the image from their cache, etc. Thanks for any help. - Mujtaba Ali To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message