diff --git a/include/core.php b/include/core.php index 640eefe6..e73519d1 100644 --- a/include/core.php +++ b/include/core.php @@ -3,6 +3,8 @@ ini_set('error_reporting', E_ALL); ini_set('display_errors', 0); require_once __DIR__ . '/constants.php'; require_once $rootpath . 'vendor/autoload.php'; +$USERUPDATESET = array(); +$query_name=array(); \Nexus\Nexus::boot(); if (!file_exists($rootpath . '.env')) { $installScriptRelativePath = 'install/install.php'; @@ -27,8 +29,6 @@ if (!isRunningInConsole() && !in_array($script, ['announce', 'scrape', 'torrentr } define('TIMENOW', time()); -$USERUPDATESET = array(); -$query_name=array(); define ("UC_PEASANT", 0); define ("UC_USER", 1); diff --git a/include/functions.php b/include/functions.php index 3f1aecd7..86ad48b7 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2008,8 +2008,8 @@ function userlogin() { $nip = ip2long($ip); if ($nip) //$nip would be false for IPv6 address { - $res = sql_query("SELECT * FROM bans WHERE $nip >= first AND $nip <= last") or sqlerr(__FILE__, __LINE__); - if (mysql_num_rows($res) > 0) + $res = sql_query("SELECT * FROM bans WHERE first <= $nip AND last >= $nip") or sqlerr(__FILE__, __LINE__); + if (mysql_num_rows($res) > 0) { header("HTTP/1.1 403 Forbidden"); print("".$lang_functions['text_unauthorized_ip']."\n"); @@ -2042,7 +2042,6 @@ function userlogin() { // error_reporting(E_ALL & ~E_NOTICE); // error_reporting(-1); // } - return $loginResult = true; } @@ -2932,13 +2931,24 @@ function stdfoot() { $yearfounded = ($year ? $year : 2007); print(" (c) "." ".$SITENAME." ".($icplicense_main ? " ".$icplicense_main." " : "").(date("Y") != $yearfounded ? $yearfounded."-" : "").date("Y")." ".VERSION."

"); printf ("[page created in %s sec", sprintf("%.3f", $totaltime)); - print (" with ".count($query_name)." db queries, ".$Cache->getCacheReadTimes()." reads and ".$Cache->getCacheWriteTimes()." writes of Redis and ".mksize(memory_get_usage())." ram]"); + $debugQuery = $enablesqldebug_tweak == 'yes' && get_user_class() >= $sqldebug_tweak; + if ($debugQuery) { + $query_name_laravel = last_query(true); + $dbQueryCount = count($query_name) + count($query_name_laravel); + } else { + $query_name_laravel = []; + $dbQueryCount = count($query_name) + last_query('COUNT'); + } + print (" with ".$dbQueryCount." db queries, ".$Cache->getCacheReadTimes()." reads and ".$Cache->getCacheWriteTimes()." writes of Redis and ".mksize(memory_get_usage())." ram]"); print ("\n"); - if ($enablesqldebug_tweak == 'yes' && get_user_class() >= $sqldebug_tweak) { + if ($debugQuery) { print("
SQL query list: "); print("Redis key read: