replace all instances of mysqli_fetch_array with mysqli_fetch_assoc for better performance and memory usage

This commit is contained in:
johnnyq
2026-01-14 17:30:23 -05:00
parent cb8b99d6ae
commit 0a30300bde
361 changed files with 1880 additions and 1904 deletions

View File

@@ -6,7 +6,7 @@ require_once '../../plugins/totp/totp.php'; //TOTP MFA Lib
// Get Company Logo
$sql = mysqli_query($mysqli, "SELECT company_logo FROM companies");
$row = mysqli_fetch_array($sql);
$row = mysqli_fetch_assoc($sql);
$company_logo = nullable_htmlentities($row['company_logo']);
@@ -32,14 +32,14 @@ $data = "otpauth://totp/ITFlow:$session_email?secret=$token";
<title>MFA Enforcement | <?php echo $session_company_name; ?></title>
<!--
<!--
Favicon
If Fav Icon exists else use the default one
If Fav Icon exists else use the default one
-->
<?php if(file_exists('../../uploads/favicon.ico')) { ?>
<link rel="icon" type="image/x-icon" href="../../uploads/favicon.ico">
<?php } ?>
<!-- Font Awesome Icons -->
<link rel="stylesheet" href="../../plugins/fontawesome-free/css/all.min.css">
@@ -66,14 +66,14 @@ $data = "otpauth://totp/ITFlow:$session_email?secret=$token";
<!-- /.login-logo -->
<div class="card">
<div class="card-body login-card-body text-center">
<p class="login-box-msg">Multi-Factor Authentication Enforced</p>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
<img src='../../plugins/barcode/barcode.php?f=png&s=qr&d=<?php echo $data; ?>' data-toggle="tooltip" title="Scan QR code into your MFA App">
<p>
<small data-toggle="tooltip" title="Can't Scan? Copy and paste this code into your app"><?php echo $token; ?></small>
<button type="button" class='btn btn-sm clipboardjs' data-clipboard-text='<?php echo $token; ?>'><i class='far fa-copy text-secondary'></i></button>

View File

@@ -22,7 +22,7 @@ $sql_recent_logs = mysqli_query($mysqli, "SELECT * FROM logs
<tbody>
<?php
while ($row = mysqli_fetch_array($sql_recent_logins)) {
while ($row = mysqli_fetch_assoc($sql_recent_logins)) {
$log_id = intval($row['log_id']);
$log_ip = nullable_htmlentities($row['log_ip']);
$log_user_agent = nullable_htmlentities($row['log_user_agent']);
@@ -58,7 +58,7 @@ $sql_recent_logs = mysqli_query($mysqli, "SELECT * FROM logs
<tbody>
<?php
while ($row = mysqli_fetch_array($sql_recent_logs)) {
while ($row = mysqli_fetch_assoc($sql_recent_logs)) {
$log_id = intval($row['log_id']);
$log_type = nullable_htmlentities($row['log_type']);
$log_action = nullable_htmlentities($row['log_action']);

View File

@@ -1,7 +1,7 @@
<?php
require_once "includes/inc_all_user.php";
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_config_calendar_first_day FROM user_settings WHERE user_id = $session_user_id"));
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT user_config_calendar_first_day FROM user_settings WHERE user_id = $session_user_id"));
$user_config_calendar_first_day = intval($row['user_config_calendar_first_day']);
?>

View File

@@ -39,7 +39,7 @@ $remember_token_count = mysqli_num_rows($sql_remember_tokens);
</button>
<?php require_once "modals/user_mfa_modal.php"; ?>
<?php } else { ?>
<a href="post.php?disable_mfa&csrf_token=<?php echo $_SESSION['csrf_token'] ?>" class="btn btn-danger"><i class="fas fa-unlock mr-2"></i>Disable MFA</a>
<?php } ?>
@@ -56,7 +56,7 @@ $remember_token_count = mysqli_num_rows($sql_remember_tokens);
<div class="card-body">
<ul>
<?php while ($row = mysqli_fetch_array($sql_remember_tokens)) {
<?php while ($row = mysqli_fetch_assoc($sql_remember_tokens)) {
$token_id = intval($row['remember_token_id']);
$token_created = nullable_htmlentities($row['remember_token_created_at']);