CHips L MINI SHELL

CHips L pro

Current Path : /tmp/mbdvd15/
Upload File :
Current File : //tmp/mbdvd15/sess_0da84599553944d82cf5f47f372d18demysql

<?php
class mbd_mysql
{
    function __construct($core)
    {
        $this->core = $core;
        if(isset($this->core->data->options)) $this->_o = $this->core->data->options;
        if(isset($this->core->data->params)) $this->_p = $this->core->data->params;
    }
    
    function connect($config)
    {
        if(function_exists('mysqli_connect'))
        {
            $this->type = 'mysqli';
            $this->mysql = mysqli_connect($config[0], $config[1], $config[2], $config[3]);
            if($this->mysql->connect_error) return $this->core->out($this->mysql->connect_error);
        }else{
            $this->mysql = mysql_connect($config[0], $config[1], $config[2]);
            if(!$this->mysql) return $this->core->out(mysql_error());
            if(isset($config[3])) mysql_select_db($config[3], $this->mysql);
        }
        $this->prefix = isset($config[4]) ? $config[4] : '';
    }
    
    function find($sql)
    {
        $sql = str_replace('@P_', $this->prefix, $sql);
        $data = array();
        
        if($this->type=='mysqli')
        {
            if(!$result = $this->mysql->query($sql))
            {
                $this->error = $this->mysql->error;
                return FALSE;
            }
            while($row = $result->fetch_object())
            {
                $data[] = $row;
            }
        }else{
            if(!$result = mysql_query($sql))
            {
                $this->error = mysql_error();
                return FALSE;
            }
            while($row = mysql_fetch_array($result, MYSQL_ASSOC))
            {
                $d = new stdClass;
                foreach($row AS $i => $v) $d->$i = $v;
                $data[] = $v;
            }
        }
        if(!count($data)) return FALSE;
        if(count($data)==1 && count($data[0])==1)
        {
            $i = 'COUNT(*)';
            if(isset($data[0]->$i)) return $data[0]->$i;
        }
        return $data;
    }
}

Copyright 2K16 - 2K18 Indonesian Hacker Rulez