Topic: db connection scripts fixes
The db connection scripts reside in the includes/db/ folder.
The currently acceptable db drivers there are:
connect_db_mysqli.inc
connect_db_mysql.inc
Line 15 in the MySQLi driver file above is:
$db_last_inserted_id = 0;
This needs to be ported to the MySQL driver too.
The function db_query() in both driver files have a line (78/79):
if ($SysPrefs->select_trail || (strstr($sql, 'SELECT') === false)) {
It is better coded to make the SELECT be the beginning part of the search string and case insensitive as well (stristr ?) like:
$sql = trim($sql);
if ($SysPrefs->select_trail || (preg_match('/^SELECT/i', $sql) === 0)) {
According to the PHP Manual:
preg_match() returns the number of times pattern matches. That will be either 0 times (no match) or 1 time because preg_match() will stop searching after the first match.