Advertisement
Guest User

Untitled

a guest
Feb 15th, 2021
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.1.0.1
  8. * @ Author : DeZender
  9. * @ Release on : 29.08.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace Session;
  15.  
  16. final class DB
  17. {
  18. public $expire = '';
  19.  
  20. public function __construct($registry)
  21. {
  22. $this->db = $registry->get('db');
  23. $this->expire = ini_get('session.gc_maxlifetime');
  24. }
  25.  
  26. public function read($session_id)
  27. {
  28. $query = $this->db->query('SELECT `data` FROM `' . DB_PREFIX . 'session` WHERE session_id = \'' . $this->db->escape($session_id) . '\' AND expire > ' . (int) time());
  29.  
  30. if ($query->num_rows) {
  31. return json_decode($query->row['data'], true);
  32. }
  33. else {
  34. return false;
  35. }
  36. }
  37.  
  38. public function write($session_id, $data)
  39. {
  40. if ($session_id) {
  41. $this->db->query('REPLACE INTO `' . DB_PREFIX . 'session` SET session_id = \'' . $this->db->escape($session_id) . '\', `data` = \'' . $this->db->escape(json_encode($data)) . '\', expire = \'' . $this->db->escape(date('Y-m-d H:i:s', time() + $this->expire)) . '\'');
  42. }
  43.  
  44. return true;
  45. }
  46.  
  47. public function destroy($session_id)
  48. {
  49. $this->db->query('DELETE FROM `' . DB_PREFIX . 'session` WHERE session_id = \'' . $this->db->escape($session_id) . '\'');
  50. ....................................................................
  51. ........................................
  52. ..................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement