Posted By

JREAM on 09/17/09


Tagged

class php session Handling light


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Juntalis
mgerdt
jameshernandez


PHP Session Class (Light)


 / Published in: PHP
 

URL: http://www.jream.com

  1. class Session
  2. {
  3.  
  4. // start session
  5. public function start()
  6. {
  7. }
  8.  
  9. public function create($name, $val)
  10. {
  11. $_SESSION[$name] = $val;
  12. }
  13.  
  14. public function get($name)
  15. {
  16. if (isset($_SESSION[$name]))
  17. {
  18. return $_SESSION[$name];
  19. }
  20. else
  21. {
  22. return false;
  23. }
  24. }
  25.  
  26. public function del($name)
  27. {
  28. unset($_SESSION[$name]);
  29. }
  30.  
  31. public function end()
  32. {
  33. $_SESSION = array();
  34. }
  35.  
  36. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: JREAM on September 17, 2009

$sess = new Session; $sess->start(); $sess->mk('user', 'ricky'); $sess->mk('pass', '123fishfarm'); $sess->end();

Posted By: JREAM on September 17, 2009

Some tips were added from a previous session example I like

You need to login to post a comment.