hjkhjkjhkhjkgjghjhgjhgjghjhghjghjhgjjnbvnvbnvk
bnmbnmbnhjkhjkhjkhjktyutyutyuytutyutyutyhgjgjghjgjghjguytutyry
/
home
/
wjcvelqp
/
public_html
/
vc
/
Upload FileeE
HOME
<?php require_once __DIR__ . '/includes/bootstrap.php'; $token = clean_string($_GET['token'] ?? $_POST['token'] ?? '', 64); $error = ''; $done = false; $valid = false; $userId = 0; if ($token !== '') { try { $st = db()->prepare('SELECT * FROM password_reset_tokens WHERE token = ? AND used_at IS NULL AND expires_at > NOW() LIMIT 1'); $st->execute([$token]); $row = $st->fetch(); if ($row) { $valid = true; $userId = (int) $row['user_id']; } } catch (Throwable $e) { } } if (!$valid) { $error = 'Invalid or expired reset link.'; } if ($valid && is_post()) { csrf_require(); $p1 = (string) ($_POST['password'] ?? ''); $p2 = (string) ($_POST['password_confirm'] ?? ''); if ($pw = validate_password($p1)) { $error = $pw; } elseif ($p1 !== $p2) { $error = 'Passwords do not match.'; } else { $hash = password_hash($p1, PASSWORD_DEFAULT); db()->prepare('UPDATE users SET password_hash = ? WHERE id = ?')->execute([$hash, $userId]); db()->prepare('UPDATE password_reset_tokens SET used_at = NOW() WHERE token = ?')->execute([$token]); log_user_activity($userId, 'password_reset', ''); $done = true; flash('success', 'Password updated. Please log in.'); redirect('login.php'); } } $page_title = 'Reset password — ' . VC_APP_NAME; include __DIR__ . '/includes/header.php'; ?> <div class="auth-wrap"><div class="container"><div class="form-box"> <h1>Reset password</h1> <?php if ($error): ?><div class="alert alert-error"><?= e($error) ?></div><?php endif; ?> <?php if ($valid && !$done): ?> <form method="post"><?= csrf_field() ?> <input type="hidden" name="token" value="<?= e($token) ?>"> <div class="form-group"><label>New password</label><input type="password" name="password" required minlength="8"></div> <div class="form-group"><label>Confirm password</label><input type="password" name="password_confirm" required minlength="8"></div> <button class="btn btn-primary" type="submit" style="width:100%">Update password</button> </form> <?php endif; ?> </div></div></div> <?php include __DIR__ . '/includes/footer.php'; ?>