tags:

views:

50

answers:

2

Hi all,

I logged into an online forum created by using PHP and was browsing some topics in the web site.
Since the weather was hot, I got to have a bath and left my computer idle for a short while.
When I came back to my computer, I pressed a "Add Post" icon.
But When I pressed to submit the new topic,the web site redirected me to the Log in page,
I gussed my cookie might have been expired. And then after I logged into the web site again,
my new post was created. I am wondering how they do this.
What is the method and technique they used?

Did they store my new post to a new cookie or session first when they found that my cookie was expired?

+2  A: 

You could do that by storing the post's content into a cookie and once you log the user in, check the cookies that you have set. If you have a cookie set with the content you would create a post with, create the post and remove the cookie. This should work with sessions as well. All depends on how you set your login system.

Raphael Caixeta
Cookies are limited to 4 kilobytes, so it would probably have to be stored in the session.
icktoofay
Only problem with using sessions is if the user is taken to the login page and doesn't login for whatever reason, the session will eventually expire. Chances are REALLY slim, but it can still happen.
Raphael Caixeta
thanks for the additional information, icktoofay.
A: 

Start by writing a decent title to your stack overflow posts. The rest will follow.

Nick
Should be a comment (and preferably rephrased).
Artefacto