38471-vm/fix_login_dup.php
2026-02-25 17:48:02 +00:00

12 lines
479 B
PHP

<?php
$content = file_get_contents('index.php');
$search = "\$_SESSION['outlet_id'] = \$u['outlet_id'];";
$replacement = "\$_SESSION['outlet_id'] = \$u['outlet_id'];";
// To fix duplicates, we can simply replace 3 of them with 1
$content = preg_replace("/(\s*\\\$_\SESSION\['outlet_id'\] = \\\$u\['outlet_id'\];){2,}/", "\n \$_SESSION['outlet_id'] = \$u['outlet_id'];", $content);
file_put_contents('index.php', $content);
echo "Duplicate login outlet_ids removed.\n";