CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Cookies and SSI

 



Samoth
Deleted

Jan 13, 2001, 11:55 AM

Post #1 of 6 (550 views)
Cookies and SSI Can't Post

I have a .shtml file where I want to use SSI for setting in different vallues from a cookie, here is the script that prints all values:

#!/usr/bin/perl
print "Content-type:text/html\n\n";

$cookie = $ENV{'HTTP_COOKIE'};

@cookies = split(/;/,$cookie);
foreach $i (@cookies) {
($name,$cid) = split(/=/,$i);
print "$name = $cid
\n";


}

How can I make it print only one of the values using SSI



randor
User

Jan 13, 2001, 2:08 PM

Post #2 of 6 (545 views)
Re: Cookies and SSI [In reply to] Can't Post

Samoth,

Please be more specific as to what you arre looking for? is there a certian one you want printed? is it a specific cookie? what cookies does it have in the array?

with a little more info we can probably help you out.





Samoth
Deleted

Jan 15, 2001, 8:41 AM

Post #3 of 6 (534 views)
Re: Cookies and SSI [In reply to] Can't Post

Ok, you know I am a newbie, and have a litle grasp of Perl.

I have this form and script that sets cookies:
http://www.builder.com/Programming/CGI/ss04b.html
this work fine.

Then I make this html and script:
http://www.builder.com/Programming/CGI/ss04c.html
(have saved the html in an .shtml file)

But I suspect that the script cookie.pl does not work
I have added: print "Content-type: text/html\n\n";
before: print "$cookie{$ARGV[0]}";

but it still not working, have you any clue what is wrong

Thanks for taking time to answer

regards Thomas Andersen






Cure
User

Jan 15, 2001, 9:23 AM

Post #4 of 6 (529 views)
Re: Cookies and SSI [In reply to] Can't Post

You can not set a cookie via SSI...
Cookies doesnt work for SSI because SSI headers are printed after the other HTTP headers...
the HTTP headers that SSIs are required to send can't set cookies...


Cure



Aquilo
journeyman

Jan 15, 2001, 10:26 AM

Post #5 of 6 (524 views)
Re: Cookies and SSI [In reply to] Can't Post

can it set a cookie if you ask for an image thru the script
<img src="cgi_bin/script.pl?image=site_logo.gif">
and have the script display an image and set a cookie?

$dir_de_images = "http://site.ext/image_dir/";
print "Content-type: text/html\n\n";
print "$cookie{$ARGV[0]}";
print "Location: $dir_de_images/$in{image}\n";

- edit -
oops forgot "Location:"


Samoth
Deleted

Jan 16, 2001, 1:04 AM

Post #6 of 6 (515 views)
Re: Cookies and SSI [In reply to] Can't Post

no, the script is not setting, it is get cookies
if you look in the Builder aricle at:
http://www.builder.com/Programming/CGI/ss04c.html
, you can GET the cookies using:
cmd exec="cookies.pl name"


(This post was edited by Samoth on Jan 16, 2001, 2:28 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives