Sunday 19 January 2014

How to Completely Log Off Users by Destroying Sessions in PHP

In order to delete a session, two things need to be done:
  • The session variables need to be destroyed: session_unset(). This ensures that all the data associated with the current session is deleted. 
  • The session id needs to be regenerated: session_regenerate_id(). This is necessary so that another session with the same id cannot be created.

It goes without saying that these methods can only be called if the session has already been started. Otherwise, you need to run session_start() first.

1 comment:

  1. No matter what your stage of play, you’ll find one thing that’s right for you. And all of our slot machines incorporate state-of-the-art technology to keep you repeatedly entertained. One of the largest perks of recent on-line slot playing is the addition ofcasino bonuses. There are broad range|a variety} of various bonuses which gamers can take advantage of|benefit from|reap the advantages of} when half in} slots on-line. If you’re hoping to walk away with a really large win,progressive jackpotslots are your best option|the best choice|your solely option}. Every so often, quantity of} lucky gamers walk away with life-changing sums of money, with many jackpots reaching the hundreds of thousands.