Fixed a bug with $mincdef and $_GET["minc"]

This commit is contained in:
pezcurrel 2023-01-02 13:54:36 +01:00
parent 21fe338c12
commit 3c85ed78a0

View file

@ -316,7 +316,7 @@ if (mb_strlen($_GET['desc'])>64) $_GET['desc']='';
function ckgnum($key,$def,$max) {
if (array_key_exists($key,$_GET)) {
$_GET[$key]=trim($_GET[$key]);
if (preg_match('#^[0-9]+$#',$_GET[$key])===1) {
if (preg_match('#^\d+$#',$_GET[$key])===1) {
$_GET[$key]=$_GET[$key]+0;
if ($_GET[$key]>$max) $_GET[$key]=$max;
} elseif ($_GET[$key]!='') {
@ -501,7 +501,7 @@ if ($_GET['desc']!='') $wheres[]='(Instances.URI LIKE "%'.$buf.'%" OR Instances.
if ($_GET['minu']!='') $wheres[]='Instances.UserCount>='.$_GET['minu'];
if ($_GET['maxu']!='') $wheres[]='Instances.UserCount<='.$_GET['maxu'];
if ($_GET['minau']!='') $wheres[]='Instances.ActiveUsersMonth>='.$_GET['minau'];
if ($_GET['minc']!='') $wheres[]='Instances.MaxTootChars>='.$_GET['minc'];
if ($_GET['minc']!='' && $_GET['minc']!='""') $wheres[]='Instances.MaxTootChars>='.$_GET['minc'];
$joins=implode(' ',$joins);
$wheres='WHERE '.implode(' AND ',$wheres);
if (!$single)
@ -514,6 +514,11 @@ $res=mysqli_query($link,$que) or muorimeglio(__LINE__.': '.mysqli_error($link),t
$debug.='MAIN QUERY EXEC TIME: '.(microtime(true)-$qbt).' sec.'.N;
$itot=mysqli_num_rows($res);
$debug.='RESULTS: '.$itot.N;
/*if ($itot==0) {
echo(_('No instance matches with the search criteria.').N.'</section>'.N.'</div>'.N.'</div>'.N.'</body>'.N.'</html>'.N);
exit(0);
}*/
$ipp=10;// istanze per pagina
$if=$ipp*($p-1);
if ($if>=$itot) {