Gossamer Forum
Home : General : Perl Programming :

check cookie

Quote Reply
check cookie
hey I'm pretty new to perl and especially cookies (in fact this is my 2 day on cookies). I've got it create a cookie and retrieve it, but i need to know whats the best way to get it check if the cookie exists. let me explain this a little bit better. i have a login page which creates a new cookie, this cookie had the member's id and session id in it. then in the main page, the cookie is used to retrieve the member id and display the relevent information. i want to stop people just typing in the address of the main page without logging in.
what's the best way to do this?

thanks
Pedge
Quote Reply
Re: [pedge] check cookie In reply to
In your script that displays the main page, first check if the cookie is there, if the session id is valid, and if not, redirect them to the login screen. If it is there and valid, display the main page.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [pedge] check cookie In reply to
Code:
if ($cgi_obj->cookie('session_cookie')) {
--- check the cookie ---
}
else {
print $cgi_obj->redirect($some_url);
}
Quote Reply
Re: [Paul] check cookie In reply to
As I just said....

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] check cookie In reply to
...without a code sample which I provided.