{"id":199404,"date":"2025-05-03T08:07:20","date_gmt":"2025-05-03T00:07:20","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199404\/"},"modified":"2025-05-03T08:07:20","modified_gmt":"2025-05-03T00:07:20","slug":"ecshop%e6%94%b9%e9%80%a0%e8%af%bb%e5%86%99%e4%b8%bb%e4%bb%8e%e6%95%b0%e6%8d%ae%e5%ba%93%e5%88%86%e7%a6%bb","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199404\/","title":{"rendered":"ecshop\u6539\u9020\u8bfb\u5199\u4e3b\u4ece\u6570\u636e\u5e93\u5206\u79bb"},"content":{"rendered":"<p>\u8bbe\u7f6eecshop\u6570\u636e\u5e93\u670d\u52a1\u5668\u5206\u79bb\uff0c\u8ba9\u8bfb\u4e0e\u5199\u5206\u5f00 \uff0c\u53ef\u5927\u5927\u52a0\u5feb\u7f51\u7ad9\u901f\u5ea6\u3002\u4e5f\u53ef\u66f4\u597d\u7684\u4f18\u5316\u7f51\u7ad9\u3002<br \/>\n<br \/> data\/config.php   &nbsp;   &lt;?php   &nbsp;   $db_name &nbsp; = &#8220;ecshop&#8221;;   &nbsp;   $prefix &nbsp; &nbsp;= &#8220;ecs_&#8221;;   &nbsp;   $timezone &nbsp; &nbsp;= &#8220;Europe\/Berlin&#8221;;   &nbsp;   $cookie_path &nbsp; &nbsp;= &#8220;\/&#8221;;   &nbsp;   $cookie_domain &nbsp; &nbsp;= &#8220;&#8221;;   &nbsp;   $session = &#8220;1440&#8221;;   &nbsp;   $_config = array();   &nbsp;   \/\/\u6570\u636e\u5e93\u4e3b\u670d\u52a1\u5668\u8bbe\u7f6e, \u652f\u6301\u591a\u7ec4\u670d\u52a1\u5668\u8bbe\u7f6e, \u5f53\u8bbe\u7f6e\u591a\u7ec4\u670d\u52a1\u5668\u65f6, \u5219\u4f1a\u968f\u673a\u4f7f\u7528\u67d0\u4e2a\u670d\u52a1\u5668   $_config[&#8216;master&#8217;][1][&#8216;dbhost&#8217;] = &#8220;192.168.2.175:3306&#8221;;   $_config[&#8216;master&#8217;][1][&#8216;dbname&#8217;] = &#8220;ecshop&#8221;;   $_config[&#8216;master&#8217;][1][&#8216;dbuser&#8217;] = &#8220;dragon&#8221;;   $_config[&#8216;master&#8217;][1][&#8216;dbpw&#8217;] = &#8220;loong&#8221;;   &nbsp;   \/*   &nbsp;*$_config[&#8216;master&#8217;][2][&#8216;dbhost&#8217;] = &#8220;&#8221;;   &nbsp;*&#8230;   &nbsp;*\/   &nbsp;   \/\/\u6570\u636e\u5e93\u4ece\u670d\u52a1\u5668\u8bbe\u7f6e( slave, \u53ea\u8bfb ), \u652f\u6301\u591a\u7ec4\u670d\u52a1\u5668\u8bbe\u7f6e, \u5f53\u8bbe\u7f6e\u591a\u7ec4\u670d\u52a1\u5668\u65f6, \u7cfb\u7edf\u6bcf\u6b21\u968f\u673a\u4f7f\u7528   $_config[&#8216;slave&#8217;][1][&#8216;dbhost&#8217;] = &#8220;192.168.2.176:3306&#8221;;   $_config[&#8216;slave&#8217;][1][&#8216;dbname&#8217;] = &#8220;ecshop&#8221;;   $_config[&#8216;slave&#8217;][1][&#8216;dbuser&#8217;] = &#8220;ivan&#8221;;   $_config[&#8216;slave&#8217;][1][&#8216;dbpw&#8217;] = &#8220;loong&#8221;;   &nbsp;   $_config[&#8216;slave&#8217;][2][&#8216;dbhost&#8217;] = &#8220;192.168.2.177:3306&#8221;;   $_config[&#8216;slave&#8217;][2][&#8216;dbname&#8217;] = &#8220;ecshop&#8221;;   $_config[&#8216;slave&#8217;][2][&#8216;dbuser&#8217;] = &#8220;ivan&#8221;;   $_config[&#8216;slave&#8217;][2][&#8216;dbpw&#8217;] = &#8220;loong&#8221;;   &nbsp;   define(&#8216;EC_CHARSET&#8217;,&#8217;utf-8&#8242;);   &nbsp;   define(&#8216;ADMIN_PATH&#8217;,&#8217;admin&#8217;);   &nbsp;   define(&#8216;AUTH_KEY&#8217;, &#8216;this is a key&#8217;);   &nbsp;   define(&#8216;OLD_AUTH_KEY&#8217;, &#8221;);   &nbsp;   define(&#8216;API_TIME&#8217;, &#8221;);   &nbsp;   ?&gt;   &nbsp;   \u521d\u59cb\u5316\u6570\u636e\u8fde\u63a5\u7c7b   &nbsp;   &nbsp;   &nbsp; &nbsp; \/* \u521d\u59cb\u5316\u6570\u636e\u5e93\u7c7b &nbsp;   &nbsp; &nbsp; &nbsp;* \u5982\u679c\u914d\u7f6e\u4e86\u4ece\u670d\u52a1\u5668\uff0c\u5219\u521d\u59cb\u5316\u4ece\u5e93\u7c7b&nbsp;   &nbsp; &nbsp; *\/ &nbsp;   &nbsp; &nbsp; if(count($_config[&#8216;slave&#8217;])) { &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; require(ROOT_PATH . &#8216;includes\/cls_mysql_slave.php&#8217;); &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; $db = new cls_mysql_slave($_config); &nbsp;   &nbsp; &nbsp; }else{ &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; require(ROOT_PATH . &#8216;includes\/cls_mysql.php&#8217;); &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; $db = new cls_mysql($_config); &nbsp;   &nbsp; &nbsp; }   \u589e\u52a0cls_mysql_slave.php\u4ece\u5e93\u7c7b   &nbsp;   &nbsp;   &lt;?php   &nbsp;   require(ROOT_PATH . &#8216;includes\/cls_mysql.php&#8217;);   class cls_mysql_slave extends cls_mysql   {   &nbsp;var $slaveid = null;   &nbsp;   &nbsp;function set_config($config){   &nbsp;if(!empty($this-&gt;config[&#8216;slave&#8217;])) {   &nbsp;$this-&gt;slaveid = array_rand($this-&gt;config[&#8216;slave&#8217;]);   &nbsp;}   &nbsp;parent::set_config($config);   &nbsp;}   &nbsp;   &nbsp;\/* \u968f\u673a\u5206\u914d\u4ece\u5e93\u8fde\u63a5 *\/   &nbsp;function set_slave_config() {&nbsp;   &nbsp;$this-&gt;settings = $this-&gt;config[&#8216;slave&#8217;][$this-&gt;slaveid];   &nbsp;$this-&gt;settings[&#8216;charset&#8217;] = $this-&gt;config[&#8216;charset&#8217;];   &nbsp;$this-&gt;settings[&#8216;pconnect&#8217;] = $this-&gt;config[&#8216;pconnect&#8217;];   &nbsp;}   &nbsp;   &nbsp;function slave_connect() {   &nbsp;$this-&gt;set_slave_config();   &nbsp;$dbhost = $this-&gt;settings[&#8216;dbhost&#8217;];   &nbsp;$dbuser = $this-&gt;settings[&#8216;dbuser&#8217;];   &nbsp;$dbpw = $this-&gt;settings[&#8216;dbpw&#8217;];   &nbsp;$dbname = $this-&gt;settings[&#8216;dbname&#8217;];   &nbsp;$this-&gt;connect($dbhost, $dbuser, $dbpw, $dbname);   &nbsp;   &nbsp;}   &nbsp;   &nbsp;   &nbsp;function query($sql, $type = &#8221;) {   &nbsp;\/\/ \u5982\u679c\u6267\u884c\u67e5\u8be2\u64cd\u4f5c\uff0c\u5219\u6267\u884c\u4ece\u5e93\u8fde\u63a5   &nbsp;if($this-&gt;slaveid &amp;&amp; strtoupper(substr($sql, 0 , 6)) == &#8216;SELECT&#8217;) {   &nbsp;$this-&gt;slave_connect();   &nbsp;}else{   &nbsp;parent::set_config($this-&gt;config);   &nbsp;$dbhost = $this-&gt;settings[&#8216;dbhost&#8217;];   &nbsp;$dbuser = $this-&gt;settings[&#8216;dbuser&#8217;];   &nbsp;$dbpw = $this-&gt;settings[&#8216;dbpw&#8217;];   &nbsp;$dbname = $this-&gt;settings[&#8216;dbname&#8217;];   &nbsp;$this-&gt;connect($dbhost, $dbuser, $dbpw, $dbname);   &nbsp;}   &nbsp;return parent::query($sql, $type);   &nbsp;}   &nbsp;   &nbsp;\/* \u5220\u9664\u5931\u8d25\u8fde\u63a5*\/   &nbsp;function del_error_link(){   &nbsp;unset($this-&gt;config[&#8216;slave&#8217;][$this-&gt;slaveid]);   &nbsp;$this-&gt;set_config($this-&gt;config);   &nbsp;$this-&gt;set_slave_config();   &nbsp;$dbhost = $this-&gt;settings[&#8216;dbhost&#8217;];   &nbsp;$dbuser = $this-&gt;settings[&#8216;dbuser&#8217;];   &nbsp;$dbpw = $this-&gt;settings[&#8216;dbpw&#8217;];   &nbsp;$dbname = $this-&gt;settings[&#8216;dbname&#8217;];   &nbsp;$this-&gt;connect($dbhost, $dbuser, $dbpw, $dbname);   &nbsp;}   &nbsp;   }   cls_mysql.php\u6587\u4ef6\u7c7b\u4fee\u6539   &nbsp;   &nbsp;   &lt;?php   &nbsp;   if (!defined(&#8216;IN_ECS&#8217;))   {   &nbsp; &nbsp; die(&#8216;Hacking attempt&#8217;);   }   &nbsp;   class cls_mysql   {   &nbsp; &nbsp; var $link_id &nbsp; &nbsp;= NULL;   &nbsp;   &nbsp; &nbsp; var $settings &nbsp; = array();   &nbsp;   &nbsp; &nbsp; var $queryCount = 0;   &nbsp; &nbsp; var $linkCount = 0;   &nbsp; &nbsp; var $queryTime &nbsp;= &#8221;;   &nbsp; &nbsp; var $queryLog &nbsp; = array();   &nbsp;   &nbsp; &nbsp; var $max_cache_time = 300; \/\/ \u6700\u5927\u7684\u7f13\u5b58\u65f6\u95f4\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d   &nbsp;   &nbsp; &nbsp; var $cache_data_dir = &#8216;temp\/query_caches\/&#8217;;   &nbsp; &nbsp; var $root_path &nbsp; &nbsp; &nbsp;= &#8221;;   &nbsp;   &nbsp; &nbsp; var $error_message &nbsp;= array();   &nbsp; &nbsp; var $platform &nbsp; &nbsp; &nbsp; = &#8221;;   &nbsp; &nbsp; var $version &nbsp; &nbsp; &nbsp; &nbsp;= &#8221;;   &nbsp; &nbsp; var $dbhash &nbsp; &nbsp; &nbsp; &nbsp; = &#8221;;   &nbsp; &nbsp; var $starttime &nbsp; &nbsp; &nbsp;= 0;   &nbsp; &nbsp; var $timeline &nbsp; &nbsp; &nbsp; = 0;   &nbsp; &nbsp; var $timezone &nbsp; &nbsp; &nbsp; = 0;   &nbsp;   &nbsp; &nbsp; var $mysql_config_cache_file_time = 0;   &nbsp;   &nbsp; &nbsp; var $mysql_disable_cache_tables = array(); \/\/ \u4e0d\u5141\u8bb8\u88ab\u7f13\u5b58\u7684\u8868\uff0c\u9047\u5230\u5c06\u4e0d\u4f1a\u8fdb\u884c\u7f13\u5b58   &nbsp; &nbsp; var $config = array();   &nbsp;   &nbsp; &nbsp; function __construct($config, $charset = &#8216;utf8&#8217;, $pconnect = 0, $quiet = 0)   &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;cls_mysql($config, $charset, $pconnect, $quiet);   &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; function cls_mysql($config, $charset = &#8216;utf8&#8217;, $pconnect = 0, $quiet = 0)   &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; if(!empty($config)) {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $config[&#8216;charset&#8217;] = $charset;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $config[&#8216;pconnect&#8217;] = $pconnect;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;config = $config;   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; if (defined(&#8216;EC_CHARSET&#8217;))   &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $charset = strtolower(str_replace(&#8216;-&#8216;, &#8221;, EC_CHARSET));   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; if (defined(&#8216;ROOT_PATH&#8217;) &amp;&amp; !$this-&gt;root_path)   &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;root_path = ROOT_PATH;   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;set_config($this-&gt;config);   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; if ($quiet)   &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $dbhost = $this-&gt;settings[&#8216;dbhost&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $dbuser = $this-&gt;settings[&#8216;dbuser&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $dbpw = $this-&gt;settings[&#8216;dbpw&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $dbname = $this-&gt;settings[&#8216;dbname&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;connect($dbhost, $dbuser, $dbpw, $dbname, $charset, $pconnect, $quiet);   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; \/\/\u968f\u673a\u5206\u914d\u6570\u636e\u5e93\u8fde\u63a5   &nbsp; &nbsp; function set_config($config) {   &nbsp; &nbsp; &nbsp; &nbsp; $sid = array_rand($config[&#8216;master&#8217;]);   &nbsp; &nbsp; &nbsp; &nbsp; $settings = $config[&#8216;master&#8217;][$sid];   &nbsp; &nbsp; &nbsp; &nbsp; $settings[&#8216;sid&#8217;] = $sid;<br \/>\n<span style=\"color:#ffffff\">\/\/www.ldhost.cn<\/span>   &nbsp; &nbsp; &nbsp; &nbsp; $settings[&#8216;charset&#8217;] = $this-&gt;config[&#8216;charset&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; $settings[&#8216;pconnect&#8217;] = $this-&gt;config[&#8216;pconnect&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;settings = $settings;   &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; function connect($dbhost, $dbuser, $dbpw, $dbname = &#8221;, $charset = &#8216;utf8&#8217;, $pconnect = 0, $quiet = 0)   &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; if ($pconnect)   &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!($this-&gt;link_id = @mysql_pconnect($dbhost, $dbuser, $dbpw)))   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!$quiet)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;ErrorMsg(&#8220;Can&#8217;t pConnect MySQL Server!&#8221;);   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; else   &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (PHP_VERSION &gt;= &#8216;4.2&#8217;)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;link_id = @mysql_connect($dbhost, $dbuser, $dbpw, true);   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;link_id = @mysql_connect($dbhost, $dbuser, $dbpw);   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mt_srand((double)microtime() * 1000000); \/\/ \u5bf9 PHP 4.2 \u4ee5\u4e0b\u7684\u7248\u672c\u8fdb\u884c\u968f\u673a\u6570\u51fd\u6570\u7684\u521d\u59cb\u5316\u5de5\u4f5c   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!$this-&gt;link_id)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!$quiet)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/\u8fde\u63a5\u8d85\u8fc710\u6b21\uff0c\u4e2d\u65ad\u8fde\u63a5\uff0c\u629b\u51fa\u9519\u8bef &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if($this-&gt;linkCount&gt;9){   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;ErrorMsg(&#8220;Can&#8217;t Connect MySQL Server!&#8221;);   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;linkCount++;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;del_error_link();   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;dbhash &nbsp;= md5($this-&gt;root_path . $dbhost . $dbuser . $dbpw . $dbname);   &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;version = mysql_get_server_info($this-&gt;link_id);   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; \/* \u5982\u679cmysql \u7248\u672c\u662f 4.1+ \u4ee5\u4e0a\uff0c\u9700\u8981\u5bf9\u5b57\u7b26\u96c6\u8fdb\u884c\u521d\u59cb\u5316 *\/   &nbsp; &nbsp; &nbsp; &nbsp; if ($this-&gt;version &gt; &#8216;4.1&#8217;)   &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($charset != &#8216;latin1&#8217;)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysql_query(&#8220;SET character_set_connection=$charset, character_set_results=$charset, character_set_client=binary&#8221;, $this-&gt;link_id);   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($this-&gt;version &gt; &#8216;5.0.1&#8217;)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysql_query(&#8220;SET sql_mode=&#8221;&#8221;, $this-&gt;link_id);   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; $sqlcache_config_file = $this-&gt;root_path . $this-&gt;cache_data_dir . &#8216;sqlcache_config_file_&#8217; . $this-&gt;dbhash . &#8216;.php&#8217;;   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; @include($sqlcache_config_file);   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;starttime = time();   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; if ($this-&gt;max_cache_time &amp;&amp; $this-&gt;starttime &gt; $this-&gt;mysql_config_cache_file_time + $this-&gt;max_cache_time)   &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($dbhost != &#8216;.&#8217;)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $result = mysql_query(&#8220;SHOW VARIABLES LIKE &#8216;basedir'&#8221;, $this-&gt;link_id);   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $row &nbsp; &nbsp;= mysql_fetch_assoc($result);   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!empty($row[&#8216;Value&#8217;]{1}) &amp;&amp; $row[&#8216;Value&#8217;]{1} == &#8216;:&#8217; &amp;&amp; !empty($row[&#8216;Value&#8217;]{2}) &amp;&amp; $row[&#8216;Value&#8217;]{2} == &#8220;\\\\&#8221;)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;platform = &#8216;WINDOWS&#8217;;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;platform = &#8216;OTHER&#8217;;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;platform = &#8216;WINDOWS&#8217;;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($this-&gt;platform == &#8216;OTHER&#8217; &amp;&amp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ($dbhost != &#8216;.&#8217; &amp;&amp; strtolower($dbhost) != &#8216;localhost:3306&#8217; &amp;&amp; $dbhost != &#8216;127.0.0.1:3306&#8217;) ||   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (PHP_VERSION &gt;= &#8216;5.1&#8217; &amp;&amp; date_default_timezone_get() == &#8216;UTC&#8217;))   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $result = mysql_query(&#8220;SELECT UNIX_TIMESTAMP() AS timeline, UNIX_TIMESTAMP(&#8216;&#8221; . date(&#8216;Y-m-d H:i:s&#8217;, $this-&gt;starttime) . &#8220;&#8216;) AS timezone&#8221;, $this-&gt;link_id);   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $row &nbsp; &nbsp;= mysql_fetch_assoc($result);   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($dbhost != &#8216;.&#8217; &amp;&amp; strtolower($dbhost) != &#8216;localhost:3306&#8217; &amp;&amp; $dbhost != &#8216;127.0.0.1:3306&#8217;)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;timeline = $this-&gt;starttime &#8211; $row[&#8216;timeline&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (PHP_VERSION &gt;= &#8216;5.1&#8217; &amp;&amp; date_default_timezone_get() == &#8216;UTC&#8217;)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;timezone = $this-&gt;starttime &#8211; $row[&#8216;timezone&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $content = &#8216;&lt;&#8216; . &#8220;?php\\r\\n&#8221; .   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8216;$this-&gt;mysql_config_cache_file_time = &#8216; . $this-&gt;starttime . &#8220;;\\r\\n&#8221; .   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8216;$this-&gt;timeline = &#8216; . $this-&gt;timeline . &#8220;;\\r\\n&#8221; .   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8216;$this-&gt;timezone = &#8216; . $this-&gt;timezone . &#8220;;\\r\\n&#8221; .   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#8216;$this-&gt;platform = &#8216; . &#8220;&#8216;&#8221; . $this-&gt;platform . &#8220;&#8216;;\\r\\n?&#8221; . &#8216;&gt;&#8217;;   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @file_put_contents($sqlcache_config_file, $content);   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; \/* \u9009\u62e9\u6570\u636e\u5e93 *\/   &nbsp; &nbsp; &nbsp; &nbsp; if ($dbname)   &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (mysql_select_db($dbname, $this-&gt;link_id) === false )   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!$quiet)   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;ErrorMsg(&#8220;Can&#8217;t select MySQL database!&#8221;);   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; &nbsp; &nbsp; else   &nbsp; &nbsp; &nbsp; &nbsp; {   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;   &nbsp; &nbsp; &nbsp; &nbsp; }   &nbsp; &nbsp; }   &nbsp;   &nbsp; &nbsp; &#8230;&#8230;   &nbsp;   &nbsp; &nbsp; \/* \u5220\u9664\u5931\u8d25\u8fde\u63a5*\/   &nbsp; &nbsp; function del_error_link(){   &nbsp; &nbsp; &nbsp; &nbsp; unset($this-&gt;config[&#8216;master&#8217;][$this-&gt;settings[&#8216;sid&#8217;]]);   &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;set_config($this-&gt;config);   &nbsp; &nbsp; &nbsp; &nbsp; $dbhost = $this-&gt;settings[&#8216;dbhost&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; $dbuser = $this-&gt;settings[&#8216;dbuser&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; $dbpw = $this-&gt;settings[&#8216;dbpw&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; $dbname = $this-&gt;settings[&#8216;dbname&#8217;];   &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;connect($dbhost, $dbuser, $dbpw, $dbname);   &nbsp; &nbsp; }   }   &nbsp;  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bbe\u7f6eecshop\u6570\u636e\u5e93\u670d\u52a1\u5668\u5206\u79bb&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-199404","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=199404"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199404\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}