臨界點

db_mysqli.class.php[bug fixed]

源文件不記得是從哪兒來的了,應(yīng)該是在論壇里某位老哥發(fā)的。

用它這個版本,后臺添加分類,添加文章都會覆蓋掉原來id為2的分類/文章。

追蹤代碼以后發(fā)現(xiàn)是在maxid獲取有問題,具體是在mysql_query 這個方法在mysqli中是沒有直接替換函數(shù)的。修改的地方就是 db_mysqli 里的 query 方法,原來的問題語句已經(jīng)注釋了,可以對比。

奇怪的是,竟然沒有人發(fā)現(xiàn)這個問題嗎?還是幾乎沒人用?

1 個附件 售價 大小 下載 時間

db_mysqli.class(bug fixed).zip 1 金幣 5.72K 32 次 2018-8-7

#1樓
發(fā)帖時間:2018-8-7   |   查看數(shù):0   |   回復(fù)數(shù):8
ikezhuo
文件名是不是多了個"i"
db_mysql.class.php
2018-8-7 #2樓
臨界點
引用 ikezhuo:

文件名是不是多了個"i" db_mysql.class.php


不是,在更新的php版本里,mysql_* 已經(jīng)被廢棄,php7里直接被刪除了,mysqli 是新版的接口函數(shù)(面向過程)和方法(面向?qū)ο螅?/div>
2018-8-7 #3樓
臨界點
引用 ikezhuo:

文件名是不是多了個"i" db_mysql.class.php


配置文件里面需要把 type 改為 mysqli
2018-8-7 #4樓
ikezhuo
引用 臨界點:

配置文件里面需要把 type 改為 mysqli


可否直接修改 kongphp.php 文件?

if(DEBUG) {
	include KONG_PATH.'base/base.func.php';
	include KONG_PATH.'base/core.class.php';
	include KONG_PATH.'base/debug.class.php';
	include KONG_PATH.'base/log.class.php';
	include KONG_PATH.'base/model.class.php';
	include KONG_PATH.'base/view.class.php';
	include KONG_PATH.'base/control.class.php';
	include KONG_PATH.'db/db.interface.php';
	include KONG_PATH.'db/db_mysql.class.php';
	include KONG_PATH.'cache/cache.interface.php';
	include KONG_PATH.'cache/cache_memcache.class.php';
}else{
	$runfile = RUNTIME_PATH.'_runtime.php';
	if(!is_file($runfile)) {
		$s  = trim(php_strip_whitespace(KONG_PATH.'base/base.func.php'), "<?ph>\r\n");
		$s .= trim(php_strip_whitespace(KONG_PATH.'base/core.class.php'), "<?ph>\r\n");
		$s .= trim(php_strip_whitespace(KONG_PATH.'base/debug.class.php'), "<?ph>\r\n");
		$s .= trim(php_strip_whitespace(KONG_PATH.'base/log.class.php'), "<?ph>\r\n");
		$s .= trim(php_strip_whitespace(KONG_PATH.'base/model.class.php'), "<?ph>\r\n");
		$s .= trim(php_strip_whitespace(KONG_PATH.'base/view.class.php'), "<?ph>\r\n");
		$s .= trim(php_strip_whitespace(KONG_PATH.'base/control.class.php'), "<?ph>\r\n");
		$s .= trim(php_strip_whitespace(KONG_PATH.'db/db.interface.php'), "<?ph>\r\n");
		$s .= trim(php_strip_whitespace(KONG_PATH.'db/db_mysql.class.php'), "<?ph>\r\n");
		$s .= trim(php_strip_whitespace(KONG_PATH.'cache/cache.interface.php'), "<?ph>\r\n");
		$s .= trim(php_strip_whitespace(KONG_PATH.'cache/cache_memcache.class.php'), "<?ph>\r\n");
		$s = str_replace('defined(\'KONG_PATH\') || exit;', '', $s);
		file_put_contents($runfile, '<?php '.$s);
		unset($s);
	}
	include $runfile;
}
core::start();


2018-8-7 #5樓
臨界點
引用 ikezhuo:

可否直接修改 kongphp.php 文件? if(DEBUG) { include KONG_PATH.'base/base.func.php'; include KONG_PATH.'base/core.class.php'; include KONG_PATH.'base/debug.class.php'; include KONG_PATH.'base/log.clas


如果改核心文件,還不如直接替換。
把 db_mysqli.class.php 名稱改為 db_mysql.class.php,文件里面的類名稱 db_mysqli 修改為 db_mysql ,然后直接替換掉原來的 db_mysql.class.php。
2018-8-8 #6樓
zkx
需要這個
2019-12-2 #7樓
rocking
這個是不是能支持PHP7
2020-2-9 #8樓
lisisi
看看呢
2021-10-27 #9樓
游客組