Posted By

tylerhall on 11/30/-1


Tagged

wrapper class session


Versions (?)

Who likes this?

28 people have marked this snippet as a favorite

luman
Bunker
katxorro70
jkochis
jackol
vali29
bioascii
huze
romanos
mrjthethird
DavidAspden
irishsk
cjwilburn
nb109
Juntalis
dantreacy
lolindirfaelivrin
scottwf
koyotebr
mecha
lfcortes
hobbyman
Almorca
liamchapman
svemoguci
jsamackay
ringo380
dennywalker


PHP Session Wrapper Class


 / Published in: PHP
 

  1. class Session
  2. {
  3. function Session()
  4. {
  5. }
  6.  
  7. function set($name, $value)
  8. {
  9. $_SESSION[$name] = $value;
  10. }
  11.  
  12. function get($name)
  13. {
  14. if(isset($_SESSION[$name]))
  15. return $_SESSION[$name];
  16. else
  17. return false;
  18. }
  19.  
  20. function del($name)
  21. {
  22. unset($_SESSION[$name]);
  23. }
  24.  
  25. function destroy()
  26. {
  27. $_SESSION = array();
  28. }
  29.  
  30. function save_prefs()
  31. {
  32. global $db, $auth;
  33. $prefs = serialize($this->prefs);
  34. $db->query("UPDATE condra_users SET prefs = '$prefs' WHERE id = '{$auth->id}'");
  35. }
  36. }

Report this snippet  

You need to login to post a comment.