Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php class db { private static $db = null; private $mysqli; private ..

Decoded Output download

<?php 
 
class db 
{ 
 
    private static $db = null; 
    private $mysqli; 
    private $sym_query = "{?}"; 
 
    public static function getDB() 
    { 
        if (self::$db == null) self::$db = new db(); 
        return self::$db; 
    } 
 
    public function getError(){ 
        return $this->mysqli->error; 
    } 
 
    public function res($v) 
    { 
        $v = trim($v); 
       // $v = strip_tags($v); 
        return $this->mysqli->real_escape_string($v); 
    } 
 
    private function __construct() 
    { 
        try { 
            date_default_timezone_set("Asia/Aden"); 
            $this->mysqli = new mysqli("localhost", "alcaonUsrFa3@ui", "fHnf@7Fhfm3Hl2Pkd", "alcaontelecomdb"); 
            if ($this->mysqli->connect_error) { 
                throw new Exception("     "); 
            } else { 
                $this->mysqli->set_charset("utf8"); 
                $this->mysqli->query("SET GLOBAL  time_zone = 'Asia/Aden"); 
            } 
        } catch (Exception $e) { 
            echo $e->getMessage(); 
        } 
        /* 
        if(isset($_SESSION['selectedPlaceNumber']) && is_numeric($_SESSION['selectedPlaceNumber'])){ 
            try { 
                $customer_id = $_SESSION['selectedPlaceNumber']; 
                $q = "select * from databasestbl where db_customer_id='$customer_id' "; 
                $res = $this->select($q); 
                if($res[0]['db_id']>0){ 
                    $db_user = $res[0]['db_user']; 
                    $db_name = $res[0]['db_name']; 
                    $db_pass = $res[0]['db_pass']; 
                    date_default_timezone_set("Asia/Aden"); 
                    $this->mysqli = new mysqli("localhost", "$db_user", "$db_pass", "$db_name"); 
                    if ($this->mysqli->connect_error) { 
                       // throw new Exception("     "); 
                    } else { 
                        $this->mysqli->set_charset("utf8"); 
                        $this->mysqli->query("SET GLOBAL  time_zone = 'Asia/Aden"); 
                    } 
                } 
            } catch (Exception $e) { 
                echo $e->getMessage(); 
            } 
        }*/ 
    } 
 
    private function getQuery($query, $params) 
    { 
        if ($params) { 
            for ($i = 0; $i < count($params); $i++) { 
                $pos = strpos($query, $this->sym_query); 
                $arg = "'" . $this->mysqli->real_escape_string($params[$i]) . "'"; 
                $query = substr_replace($query, $arg, $pos, strlen($this->sym_query)); 
            } 
        } 
        return $query; 
    } 
 
    public function select($query, $params = false) 
    { 
        $result_set = $this->mysqli->query($this->getQuery($query, $params)); 
        if (!$result_set) return false; 
        return $this->resultSetToArray($result_set); 
    } 
 
    public function rows($query, $params = false) 
    { 
        $result_set = $this->mysqli->query($this->getQuery($query, $params)); 
        return $result_set->num_rows; 
    } 
 
    public function query($query, $params = false) 
    { 
        $success = $this->mysqli->query($this->getQuery($query, $params)); 
        if ($success) { 
            if($this->mysqli->insert_id > 0){ 
                return $this->mysqli->insert_id; 
            }else{ 
                if($this->mysqli->affected_rows > 0){ 
                    return true; 
                }else{ 
                    return false; 
                } 
            } 
 
        } else  return false; 
    } 
 
    private function resultSetToArray($result_set) 
    { 
        $array = array(); 
        while (($row = $result_set->fetch_assoc()) != false) { 
            $array[] = $row; 
        } 
        return $array; 
    } 
 
    public function __destruct() 
    { 
        if ($this->mysqli) $this->mysqli->close(); 
    } 
} 
 
?>

Did this file decode correctly?

Original Code

<?php

class db
{

    private static $db = null;
    private $mysqli;
    private $sym_query = "{?}";

    public static function getDB()
    {
        if (self::$db == null) self::$db = new db();
        return self::$db;
    }

    public function getError(){
        return $this->mysqli->error;
    }

    public function res($v)
    {
        $v = trim($v);
       // $v = strip_tags($v);
        return $this->mysqli->real_escape_string($v);
    }

    private function __construct()
    {
        try {
            date_default_timezone_set("Asia/Aden");
            $this->mysqli = new mysqli("localhost", "alcaonUsrFa3@ui", "fHnf@7Fhfm3Hl2Pkd", "alcaontelecomdb");
            if ($this->mysqli->connect_error) {
                throw new Exception("     ");
            } else {
                $this->mysqli->set_charset("utf8");
                $this->mysqli->query("SET GLOBAL  time_zone = 'Asia/Aden");
            }
        } catch (Exception $e) {
            echo $e->getMessage();
        }
        /*
        if(isset($_SESSION['selectedPlaceNumber']) && is_numeric($_SESSION['selectedPlaceNumber'])){
            try {
                $customer_id = $_SESSION['selectedPlaceNumber'];
                $q = "select * from databasestbl where db_customer_id='$customer_id' ";
                $res = $this->select($q);
                if($res[0]['db_id']>0){
                    $db_user = $res[0]['db_user'];
                    $db_name = $res[0]['db_name'];
                    $db_pass = $res[0]['db_pass'];
                    date_default_timezone_set("Asia/Aden");
                    $this->mysqli = new mysqli("localhost", "$db_user", "$db_pass", "$db_name");
                    if ($this->mysqli->connect_error) {
                       // throw new Exception("     ");
                    } else {
                        $this->mysqli->set_charset("utf8");
                        $this->mysqli->query("SET GLOBAL  time_zone = 'Asia/Aden");
                    }
                }
            } catch (Exception $e) {
                echo $e->getMessage();
            }
        }*/
    }

    private function getQuery($query, $params)
    {
        if ($params) {
            for ($i = 0; $i < count($params); $i++) {
                $pos = strpos($query, $this->sym_query);
                $arg = "'" . $this->mysqli->real_escape_string($params[$i]) . "'";
                $query = substr_replace($query, $arg, $pos, strlen($this->sym_query));
            }
        }
        return $query;
    }

    public function select($query, $params = false)
    {
        $result_set = $this->mysqli->query($this->getQuery($query, $params));
        if (!$result_set) return false;
        return $this->resultSetToArray($result_set);
    }

    public function rows($query, $params = false)
    {
        $result_set = $this->mysqli->query($this->getQuery($query, $params));
        return $result_set->num_rows;
    }

    public function query($query, $params = false)
    {
        $success = $this->mysqli->query($this->getQuery($query, $params));
        if ($success) {
            if($this->mysqli->insert_id > 0){
                return $this->mysqli->insert_id;
            }else{
                if($this->mysqli->affected_rows > 0){
                    return true;
                }else{
                    return false;
                }
            }

        } else  return false;
    }

    private function resultSetToArray($result_set)
    {
        $array = array();
        while (($row = $result_set->fetch_assoc()) != false) {
            $array[] = $row;
        }
        return $array;
    }

    public function __destruct()
    {
        if ($this->mysqli) $this->mysqli->close();
    }
}

?>

Function Calls

None

Variables

None

Stats

MD5 4c5b813ae3972f54a450999f16e127cc
Eval Count 0
Decode Time 100 ms