hjkhjkjhkhjkgjghjhgjhgjghjhghjghjhgjjnbvnvbnvk
bnmbnmbnhjkhjkhjkhjktyutyutyuytutyutyutyhgjgjghjgjghjguytutyry
/
home
/
wjcvelqp
/
public_html
/
vc
/
Upload FileeE
HOME
<?php require_once __DIR__ . '/includes/bootstrap.php'; $msg = ''; $err = ''; if (is_post()) { csrf_require(); $email = strtolower(clean_string($_POST['email'] ?? '', 190)); if (!validate_email($email)) { $err = 'Enter a valid email.'; } else { try { $st = db()->prepare('SELECT id, full_name FROM users WHERE email = ? LIMIT 1'); $st->execute([$email]); $u = $st->fetch(); // Always show same message (no email enumeration) $msg = 'If that email exists, a reset link has been generated.'; if ($u) { $token = bin2hex(random_bytes(32)); db()->prepare('INSERT INTO password_reset_tokens (user_id, token, expires_at) VALUES (?,?, DATE_ADD(NOW(), INTERVAL 2 HOUR))') ->execute([(int)$u['id'], $token]); $link = url('reset-password.php?token=' . $token); $mailErr = null; $sent = send_mail($email, 'Reset your VillageConnect password', mail_template( 'Password reset', '<p>Hello ' . e($u['full_name']) . ',</p><p><a href="' . e($link) . '">Reset your password</a></p><p>This link expires in 2 hours.</p>' ), $mailErr); if (!$sent && VC_DEBUG) { $msg .= ' Debug link: ' . $link; } elseif ($mailErr && !VC_DEBUG) { $msg .= ' (Configure SMTP to receive email.)'; } } } catch (Throwable $e) { $err = 'Could not process request.'; } } } $page_title = 'Forgot password — ' . VC_APP_NAME; include __DIR__ . '/includes/header.php'; ?> <div class="auth-wrap"><div class="container"><div class="form-box"> <h1>Forgot password</h1> <?php if ($err): ?><div class="alert alert-error"><?= e($err) ?></div><?php endif; ?> <?php if ($msg): ?><div class="alert alert-info"><?= e($msg) ?></div><?php endif; ?> <form method="post"><?= csrf_field() ?> <div class="form-group"><label>Email</label><input type="email" name="email" required></div> <button class="btn btn-primary" type="submit" style="width:100%">Send reset link</button> </form> <p style="margin-top:12px"><a href="<?= e(url('login.php')) ?>">Back to login</a></p> </div></div></div> <?php include __DIR__ . '/includes/footer.php'; ?>