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