Gossamer Forum
Quote Reply
cookies
Hi,

Can we write and read cookies in just one request?

Thanks,

Cheers,

Dat

Scripts installation and plugin creation
Plugins
Quote Reply
Re: [tandat] cookies In reply to
Hi,

Simple answer, no =)

You have to write the cookie, and then when the page is re-loaded you can call the cookie. If you want to access it in the same page, you have to do something like;

$IN->cookie( -opts here -value=$IN->param('value') )


Then, you could use something like;

Code:
if ($IN->cookie('cookie_name')) {
print "Got: " . $IN->cookie('cookie_name');
} elsif ($IN->param('value')) {
print "Got: " . $IN->param('value');
} else {
print "Neither values exist...";
}

When working with logins, and "intermeditory" page normally sorts this. Example;

Login page --> Enters login details ---> Details are verified, and cookie set ---> "Please Wait" page shows, which just refreshes the page ---> The cookie should be set when the page is refreshed :)

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [tandat] cookies In reply to
If you are writing the cookie then you already know the value so why would you need to retrieve it?

Btw - you can do it in a round about way if you are using GT::CGI by accessing the internal attributes of the cookie using the $IN object.

Last edited by:

Hargreaves: Nov 29, 2005, 6:55 AM
Quote Reply
Re: [Hargreaves] cookies In reply to
Thank you all.

The problem is I want to make sure the browser has stored that cookie or not so that I can print out the suitable content.

Javascript can help this?

Thanks,

Cheers,

Dat

Scripts installation and plugin creation
Plugins