View Single Post
  #17  
Old 2nd January 2020, 17:54
smoky28's Avatar
smoky28 smoky28 is offline
Senior Member
 
Join Date: Aug 2010
Hungary
Posts: 82
Default
Create mysqli.php include folder
add bittorrent.php.

require_once("mysqli.php");



and put the global $ mysqli line for each function or where blobal i have just paste the $ mysqli add-on and at the very bottom of mysqli php there is a database connection there and enter and enter the database entry. but if you get stuck on skype you will be happy to help.


Code:
global $mysqli;<?function getMicroTime() {    list($usec, $sec) = explode(" ", microtime());    return ((float)$usec + (float)$sec);}class MySQLiDB extends mysqli{    private $query_id = 0;    public  $queries = 0;    public  $querytime = 0;    public  $showerr = true;    public  $debug = false;    public  $querydebug = array();    public function __construct($host, $user, $pass, $db)    {        if (!extension_loaded('mysqli'))            $this->halt('The PHP MySQLi extension is not loaded,!', false);        parent::__construct($host, $user, $pass, $db);        if($this->connect_errno)            $this->halt('Could not connect to MySQL server,');            }    public function affected_rows()    {        return $this->affected_rows;    }    public function close()    {        return @parent::close();    }    public function escape($input)    {        return $this->real_escape_string($input);    }    public function query($query_str)    {        if (func_num_args() > 1)        {            $args = func_get_args();            unset($args[0]);            $args = array_map(array($this, "real_escape_string"), $args);            $query_str = vsprintf($query_str, $args);        }        $QueryTime = microtime(true);        $this->query_id = parent::query($query_str);        $QueryTime = microtime(true) - $QueryTime;        if ($this->debug)        {            $this->querydebug[] = array('time' => $QueryTime, 'sql' => $query_str);            $this->querytime += $QueryTime;        }        if(!$this->query_id)            $this->halt('Querly error: '.$query_str);        $this->queries++;        return $this->query_id;    }    public function fetch_array($query_id = -1, $datatype = 'assoc')    {        if($query_id != -1)            $this->query_id = $query_id;        if($datatype === 'num')            $datatype = MYSQL_NUM;        else            $datatype = MYSQL_ASSOC;        $this->record = $query_id->fetch_array($datatype);        return $this->record;    }        public function fetch_assoc($query_id = -1)    {        if($query_id != -1)            $this->query_id = $query_id;        $this->record = $query_id->fetch_array(MYSQL_ASSOC);        return $this->record;    }    public function fetch_row($query_id = -1)    {        if($query_id != -1)            $this->query_id = $query_id;        $this->record = $query_id->fetch_row();        return $this->record;    }    public function num_rows($query_id=-1)    {        if($query_id!=-1)            $this->query_id = $query_id;        return $query_id->num_rows;    }    public function free_result($query_id=-1)    {        if($query_id!=-1)            $this->query_id = $query_id;        return $query_id->free();    }    private function halt($errormsg, $mysqli = true)    {        if (!$this->showerr)            return;        if($mysqli)        {            $errormsg .= "\n";            $errormsg .= 'MySQLi error code: '.$this->errno."\n";            $errormsg .= 'MySQLi Problem Description: '.$this->error."\n";        }        $errormsg .= 'Time: '.date('Y-m-d H:i:s')  ."\n";        $errormsg .= 'Script: '.htmlspecialchars(getenv('REQUEST_URI'))   ."\n";        $errormsg .= 'Referer: '.htmlspecialchars(getenv('HTTP_REFERER')) ."\n";        die("<h2>MySQLi error</h2><br />".nl2br($errormsg));    }}$mysqli = new mysqlidb('localhost','user','pass','database');?>
__________________
Sky-Tech Developer Team Hungary

Reply With Quote