Advertisement
Guest User

Untitled

a guest
Jan 30th, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. <?php
  2. /*
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.5.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 22.06.2018
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. ini_set('memory_limit', '-1');
  15. ini_set('max_execution_time', 60);
  16. ini_set('displayerrors', 0);
  17. ob_implicit_flush();
  18. error_reporting(32767);
  19. ini_set('display_errors', 0);
  20. ignore_user_abort(false);
  21. $config = include 'config.php';
  22. extract($config);
  23. session_start();
  24. $Utilities = new Utilities();
  25. $ayarlar = get_option();
  26. $lisansCheck = lisansCheck();
  27. $main_controller = new main_controller();
  28. define('CR', "\r");
  29. define('LF', "\n");
  30. define('CRLF', "\r\n");
  31. define('BR', '<br />' . LF);
  32.  
  33. class Utilities
  34. {
  35. private static $instance = null;
  36. public $cache_time = 1800;
  37. private $con = null;
  38. private $result = null;
  39. private $ayarlar = null;
  40.  
  41. public function __construct()
  42. {
  43. global $config;
  44. self::$instance = &$this;
  45.  
  46. if (isset($config) && !empty($config) && is_array($config)) {
  47. extract($config);
  48. $this->con = new PDO('mysql:host=' . $DB_SERVER . ';dbname=' . $DB_DATABASE, $DB_USERNAME, $DB_PASSWORD);
  49. $this->con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
  50. $queries = array("SET NAMES 'utf8'");
  51.  
  52. foreach ($queries as $query) {
  53. $this->con->query($query);
  54. }
  55. }
  56. }
  57.  
  58. public function __destruct()
  59. {
  60. $this->con = null;
  61. $this->result = null;
  62. }
  63.  
  64. public function query($queryString, $bindValues = null, $fetch_style = PDO::FETCH_OBJ)
  65. {
  66. $result = null;
  67. $queryType = null;
  68.  
  69. if (preg_match('/update\\s([a-zA-Z0-9_]{1,20}+)\\sset/siU', $queryString, $table_match)) {
  70. $queryType = 'UPDATE';
  71. } else {
  72. if (preg_match('/insert\\sinto\\s([a-zA-Z0-9_]{1,20}+)/siU', $queryString, $table_match)) {
  73. $queryType = 'INSERT';
  74. } else {
  75. if (preg_match('/delete\\sfrom\\s([a-zA-Z0-9_]{1,20}+)/siU', $queryString, $table_match)) {
  76. $queryType = 'DELETE';
  77. } else {
  78. if (preg_match('/from\\s*([a-zA-Z0-9_]{1,20}+)/siU', $queryString, $table_match)) {
  79. $queryType = 'SELECT';
  80. }
  81. }
  82. }
  83. }
  84.  
  85. $query = $this->con->prepare($queryString);
  86.  
  87. if (isset($bindValues) && is_array($bindValues)) {
  88. foreach ($bindValues as $key => $value) {
  89. $key = ':' . $key;
  90. $query->bindValue($key, $value, PDO::PARAM_STR);
  91. }
  92. }
  93.  
  94. $query->execute();
  95.  
  96. if ($queryType == 'INSERT') {
  97. $lastInsertId = $this->con->lastInsertId();
  98.  
  99. return $lastInsertId;
  100. }
  101.  
  102. $result = new stdClass();
  103. $rowCount = $query->rowCount();
  104. $result->rowCount = $rowCount;
  105.  
  106. if ($queryType == 'SELECT') {
  107. $result->fetchAll = $query->fetchAll($fetch_style);
  108.  
  109. if (0 < count($result->fetchAll)) {
  110. $result->fetch = $result->fetchAll[0];
  111. }
  112. }
  113.  
  114. return $result;
  115. }
  116.  
  117. public function insert($table, $data)
  118. {
  119. $values = '';
  120. $i = 0;
  121. $keys = '';
  122. $bindValues = array();
  123.  
  124. foreach ($data as $key => $val) {
  125. $bindValues[$key] = $val;
  126. $keys .= ($i == 0 ? $key : ',' . $key);
  127. $values .= ($i == 0 ? ':' . $key : ', :' . $key);
  128. $i++;
  129. }
  130. $sql = 'INSERT INTO ' . $table . ' (' . $keys . ') values(' . $values . ')';
  131. ...................................................................
  132. .......................................
  133. .....................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement