Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.1.0.1
- * @ Author : DeZender
- * @ Release on : 29.08.2020
- * @ Official site : http://DeZender.Net
- *
- */
- class Database
- {
- private $con;
- private $error = '';
- private $shouldLogQueries = false;
- private $queryLogFile = '';
- private $lastExecutedStatement;
- public function __construct($server = '', $user = '', $pass = '', $dbname = '', $new_connection = false)
- {
- if (($server == '') && ($user == '') && ($pass == '') && ($dbname == '')) {
- $server = CONF_DB_SERVER;
- $user = CONF_DB_USER;
- $pass = CONF_DB_PASS;
- $dbname = CONF_DB_NAME;
- }
- if ($new_connection) {
- $this->con = new mysqli($server, $user, $pass, $dbname);
- $now = new DateTime();
- $mins = $now->getOffset() / 60;
- $sgn = ($mins < 0 ? -1 : 1);
- $mins = abs($mins);
- $hrs = floor($mins / 60);
- $mins -= $hrs * 60;
- $offset = sprintf('%+d:%02d', $hrs * $sgn, $mins);
- $this->con->query('SET time_zone=\'' . $offset . '\';');
- }
- else {
- $this->con = SingletonMysqli::getInstance($server, $user, $pass, $dbname);
- }
- if ($this->con->connect_error) {
- trigger_error('Database Connection Error: ' . $this->con->connect_errno . ': ' . $this->con->connect_error, 256);
- exit();
- }
- }
- public function getConnectionObject()
- {
- return $this->con;
- }
- public function query($qry)
- {
- $this->lastExecutedStatement = $this->prepareStatement($qry);
- if (false === $this->lastExecutedStatement) {
- return false;
- }
- $result = $this->lastExecutedStatement->execute();
- if (!$result) {
- $this->error = $this->lastExecutedStatement->getError();
- $this->error .= $qry;
- }
- return $result;
- }
- public function prepareStatement($qry)
- {
- $this->con->stmt_init();
- $smt = $this->con->prepare($qry);
- .......................................................
- ...............................
- ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement