your login script would have to try to set the cookie, then try to read it back...if it is set then you're golden and can forward somewhere else.
If when you try to read it back it is not set you could call a function that sets all the vars you need for login in session vars instead.
Then on your pages you would have to check for the cookie first, and if that test fails check session for the login.
Best I have off the top of my head as far as algorithm.