You are here: Re: cookie question « HTML « IT news, forums, messages
Re: cookie question

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация