Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3. class SessionManager{
  4. public function __construct() {
  5. session_start();
  6. }
  7. public function is_exist($a){
  8. return isset($_SESSION["system".$a]);
  9. }
  10.  
  11. public function add($a,$b){
  12. $_SESSION["system".$a]=$b;
  13. }
  14. public function addCookies($a,$b){
  15. setcookie($a, $b, time() + (86400 * 30), "/"); // 86400 = 1 day
  16. }
  17. public function sessionKey(){
  18. return session_id();
  19. }
  20. public function value($k){
  21. if(!isset($_SESSION[$k]))
  22. $this->close("SESSION_NOT_DEFINED".__LINE__);
  23. return $_SESSION[$k];
  24. }
  25. public function __get($key)
  26. {
  27. echo "tried to call $key";
  28. return get_instance()->$key;
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement