How can i start a user session and mantain it throughout all the pages of my web application?
I am using Li开发者_如何学JAVAghttpd and Fastcgi module to use c++ binaries for my application. I'm actually wondering how can i authenticate a user and then keep him authenticated throughout all the pages until he logout (and, after that, destroy the session). I was thinking about a method that check if the username and the password (stored in Mysql) submitted correspond and if they do it returns true and store the boolean parameter in the db itself. Is it a good method?
The standard way is to generate a session ID and store it in a cookie (and the database) after they've been authenticated. Any information for the session will be stored in the database with the session ID, that way you aren't passing the actual password back and forth on each request. http://en.wikipedia.org/wiki/Session_ID
精彩评论