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

18 lines
897 B
PHP

<?php
$c = file_get_contents('index.php');
$find_edit_post = '$status = $_POST[\'status\'] ?? \'active\';
if ($id && $username) {
$stmt = db()->prepare("UPDATE users SET username = ?, email = ?, phone = ?, group_id = ?, status = ? WHERE id = ?");
$stmt->execute([$username, $email, $phone, $group_id, $status, $id]);';
$repl_edit_post = '$status = $_POST[\'status\'] ?? \'active\';
$outlet_id = !empty($_POST[\'outlet_id\']) ? (int)$_POST[\'outlet_id\'] : null;
if ($id && $username) {
$stmt = db()->prepare("UPDATE users SET username = ?, email = ?, phone = ?, group_id = ?, status = ?, outlet_id = ? WHERE id = ?");
$stmt->execute([$username, $email, $phone, $group_id, $status, $outlet_id, $id]);';
$c = str_replace($find_edit_post, $repl_edit_post, $c);
file_put_contents('index.php', $c);
echo "Edit Post Patched\n";