ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/thietkewebvumi.com/lib/ |
<?php class db_driver { var $obj = array ( "sql_database" => "", "sql_user" => "", "sql_pass" => "", "sql_host" => "", "sql_port" => "", "sql_tbl_prefix" => "", 'debug' => 0 ); var $query_id = ""; var $connection_id = ""; var $record_row = array(); var $return_die = 0; var $error = ""; var $mysql_version = ""; var $failed = 0; // Connect to the database /*========================================================================*/ function connect() { global $INFO,$CORE; $this->obj['sql_database'] = $INFO['sql_database']; $this->obj['sql_user'] = $INFO['sql_user']; $this->obj['sql_pass'] = $INFO['sql_pass']; $this->obj['sql_host'] = $INFO['sql_host']; $this->obj['sql_tbl_prefix'] = $INFO['sql_tbl_prefix']; $this->connection_id = mysql_connect($this->obj['sql_host'] ,$this->obj['sql_user'] ,$this->obj['sql_pass']); $this->query("SET NAMES 'utf8'", $this->connection_id); if ( !mysql_select_db($this->obj['sql_database'], $this->connection_id) ) { echo ("ERROR: Cannot find database ".$this->obj['sql_database']); } // import setting from database $ret = $this->compile_query ("conf_key,conf_value","NNCCMS_settings",'',''); while ($row_info = $this->fetch_row($ret)) { $CORE->vars[$row_info['conf_key']] = $row_info['conf_value']; } // end import setting } // Process a query /*========================================================================*/ function query($the_query) { global $INFO; //-------------------------------------- // Change the table prefix if needed //-------------------------------------- if ($this->obj['sql_tbl_prefix'] != "NNCCMS_") { $the_query = preg_replace("/NNCCMS_(\S+?)([\s\.,]|$)/", $this->obj['sql_tbl_prefix']."\\1\\2", $the_query); } if ($INFO['sql_tbl_prefix_forum'] != "NNCCMS_") { $the_query = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $INFO['sql_tbl_prefix_forum']."\\1\\2", $the_query); } if ($this->obj['debug']) { global $Debug; $Debug->startTimer(); } $this->query_id = mysql_query($the_query, $this->connection_id); if (! $this->query_id ) { $this->fatal_error("mySQL query error: $the_query"); } $this->query_count++; return $this->query_id; } // Fetch a row based on the last query /*========================================================================*/ function fetch_row($query_id = "") { if ($query_id == "") { $query_id = $this->query_id; } $this->record_row = mysql_fetch_array($query_id, MYSQL_ASSOC); return $this->record_row; } /*========================================================================*/ function get_num_rows() { return mysql_num_rows($this->query_id); } function compile_query($field_name,$table_name,$condition="",$order_by=""){ if ($order_by !=""){ $ret=$this->query("Select $field_name From $table_name $condition Order By $order_by"); }else{ $ret=$this->query("Select $field_name From $table_name $condition"); } return $ret; } function free_result($query_id="") { if ($query_id == "") { $query_id = $this->query_id; } mysql_free_result($query_id); } function close_db() { return mysql_close($this->connection_id); } // Basic error handler //////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////// function fatal_error($the_error) { global $INFO; // Are we simply returning the error? if ($this->return_die == 1) { $this->error = mysql_error(); $this->error_no = mysql_errno(); $this->failed = 1; return; } $returned_error=mysql_error(); $the_error .= "\n\nmySQL error: ".$returned_error."\n"; if(preg_match("/Can't open file: '(.+)\.MYI'. \(errno: 145\)/si",$returned_error,$matches)) { $this->query("REPAIR TABLE ".$matches[1]); $the_error .= "\nThis Error has been automatically fixed, please refresh your browser\n\n"; } $the_error .= "mySQL error code: ".$this->error_no."\n"; $the_error .= "Date: ".date("l dS of F Y h:i:s A"); $out = "<html><head><title>Database Error</title> <style>P,BODY{ font-family:arial,sans-serif; font-size:11px; }</style></head><body> <br><b>There appears to be an error with the ".$INFO['sitename']." database.</b><br> You can try to refresh the page by clicking <a href=\"javascript:window.location=window.location;\">here</a>, if this does not fix the error, you can contact webmaster <br><br><b>Error Returned</b><br> <form name='mysql'><textarea rows=\"15\" cols=\"60\">".htmlspecialchars($the_error)."</textarea></form></body></html>"; echo($out); die(""); } function field_exists($field, $table) { $this->return_die = 1; $this->error = ""; $this->query("SELECT COUNT($field) as count FROM $table"); $return = 1; if ( $this->failed ) { $return = 0; } $this->error = ""; $this->return_die = 0; $this->error_no = 0; $this->failed = 0; return $return; } function get_query_cnt() { return $this->query_count; } function sql_get_version() { if ( ! $this->mysql_version and ! $this->true_version ) { $this->query("SELECT VERSION() AS version"); if ( ! $row = $this->fetch_row() ) { $this->query("SHOW VARIABLES LIKE 'version'"); $row = $this->fetch_row(); } $this->true_version = $row['version']; $tmp = explode( '.', preg_replace( "#[^\d\.]#", "\\1", $row['version'] ) ); $this->mysql_version = sprintf('%d%02d%02d', $tmp[0], $tmp[1], $tmp[2] ); } } } ?>