臨界點(diǎn)

db_mysqli.class.php[bug fixed]

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

用它這個(gè)版本,后臺(tái)添加分類,添加文章都會(huì)覆蓋掉原來(lái)id為2的分類/文章。

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

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

1 個(gè)附件 售價(jià) 大小 下載 時(shí)間

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

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

文件名是不是多了個(gè)"i" db_mysql.class.php


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

文件名是不是多了個(gè)"i" db_mysql.class.php


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

配置文件里面需要把 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樓
臨界點(diǎn)
引用 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 ,然后直接替換掉原來(lái)的 db_mysql.class.php。
2018-8-8 #6樓
zkx
需要這個(gè)
2019-12-2 #7樓
rocking
這個(gè)是不是能支持PHP7
2020-2-9 #8樓
lisisi
看看呢
2021-10-27 #9樓
游客組