Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Aug 1999 13:35:54 -0400
From:      "Mujtaba Ali" <mujtaba@bitsmart.com>
To:        <freebsd-questions@freebsd.org>
Cc:        <mujtaba@bitsmart.com>
Subject:   Perl/SSI hacking
Message-ID:  <19990805173605.HIQL9930.mail.rdc1.md.home.com@mujtaba>

next in thread | raw e-mail | index | archive | help
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: 

<HTML>
<HEAD><TITLE></TITLE></HEAD>
<BODY>
<!--#SET VAR="IMAGE_PROTECTION_CODE" VALUE="43@3!ERT" -->
<IMG SRC="/cgi-bin/test.pl">
</BODY>
</HTML>

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<BR>\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 <IMAGE>;
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990805173605.HIQL9930.mail.rdc1.md.home.com>