Posted by Toby Inkster on 12/20/05 10:24
Eric wrote:
> how do you create the originating page in such a way that the cgi
> executes before sending out headers?
CGI *always* executes before sending out headers. SSI always executes
*after* sending out headers. Don't use SSI. Use CGI.
= ~/public_html/cgi-bin/test.cgi ==============================
#!/usr/bin/perl
print "Set-Cookie: hello=its_me\n";
print <<CHUNK1;
Content-Type: text/html; charset=utf-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<title>Cookie</title>
<p>The cookie has been set to 'hello=its_me'!</p>
CHUNK1
$_ = $ENV{'COOKIES'};
print "<p>It used to be '$_'.</p>\n"
unless (length==0);
===============================================================
Then visit:
http://yoursite.example.com/cgi-bin/test.cgi
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
[Back to original message]
|