| Server IP : 3.111.61.48 / Your IP : 216.73.216.67 Web Server : Apache System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.2.31 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/vhost/book.gyaniguru.org/ |
Upload File : |
<?php
require_once 'includes/db.php';
session_start();
$login_total_books = get_row("SELECT COUNT(*) as count FROM books WHERE is_upcoming = 0")['count'] ?? 0;
$login_total_users = get_row("SELECT COUNT(*) as count FROM users")['count'] ?? 0;
$login_avg_rating = get_row("SELECT ROUND(AVG(rating), 1) as avg FROM reviews WHERE status = 'approved'")['avg'] ?? '4.9';
$error = '';
$email = '';
if (isset($_SESSION['user_id'])) {
$redirect = $_GET['redirect'] ?? 'index.php';
header("Location: " . $redirect);
exit();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$email = $_POST['email'] ?? '';
$password = $_POST['password'] ?? '';
$user = get_row("SELECT * FROM users WHERE email = ?", [$email]);
if ($user && password_verify($password, $user['password'])) {
$_SESSION['user_id'] = $user['id'];
$_SESSION['user_name'] = $user['name'];
$_SESSION['user_email'] = $user['email'];
$redirect = $_GET['redirect'] ?? 'index.php';
header("Location: " . $redirect);
exit();
} else {
$error = "Incorrect email or password. Please try again! 🙏";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login — Gyani Guru by JMC</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/auth.css">
</head>
<body class="auth-body">
<div class="auth-bg" id="authBg"></div>
<a href="index.php" class="auth-back-btn">
<i class="bi bi-arrow-left"></i> Back to Home
</a>
<div class="auth-wrapper" data-aos="zoom-in">
<div class="auth-container">
<!-- Left Panel: Branding -->
<div class="auth-brand-panel">
<div class="auth-brand-art">🕉️</div>
<div class="auth-brand-content text-center">
<div class="auth-om-symbol">🔱</div>
<h2 class="auth-brand-title">GyaniGuru by JMC</h2>
<div class="auth-brand-sub">AUTHENTIC VEDIC WISDOM</div>
<div class="auth-brand-divider">✦ ✦ ✦</div>
<p class="auth-brand-quote">"Welcome back to your spiritual journey. Enter your sanctuary of knowledge."</p>
<div class="auth-brand-stats">
<div class="auth-stat">
<span class="auth-stat-num"><?php echo $login_total_books; ?>+</span>
<span class="auth-stat-lbl">BOOKS</span>
</div>
<div class="auth-stat">
<span class="auth-stat-num"><?php echo $login_total_users > 0 ? $login_total_users : '50'; ?>+</span>
<span class="auth-stat-lbl">SEEKERS</span>
</div>
<div class="auth-stat">
<span class="auth-stat-num"><?php echo $login_avg_rating; ?></span>
<span class="auth-stat-lbl">RATING</span>
</div>
</div>
</div>
</div>
<!-- Right Panel: Form -->
<div class="auth-form-panel">
<div class="auth-form-inner">
<div class="auth-form-header">
<h1 class="auth-form-title">Login 🙏</h1>
<p class="auth-form-subtitle">Access your divine library and orders.</p>
</div>
<?php if($error): ?>
<div class="auth-alert auth-alert-error">
<i class="bi bi-exclamation-octagon-fill"></i>
<span><?php echo $error; ?></span>
</div>
<?php endif; ?>
<form action="" method="POST" id="loginForm">
<div class="auth-field-group">
<label class="auth-label">Email Address</label>
<div class="auth-input-wrap">
<i class="bi bi-envelope auth-input-icon"></i>
<input type="email" name="email" class="auth-input" required value="<?php echo htmlspecialchars($email); ?>" placeholder="Enter your email">
</div>
</div>
<div class="auth-field-group">
<label class="auth-label">Password</label>
<div class="auth-input-wrap">
<i class="bi bi-key auth-input-icon"></i>
<input type="password" name="password" id="passwordInput" class="auth-input" required placeholder="Enter your password">
<button type="button" class="auth-eye-btn" onclick="togglePassword()">
<i class="bi bi-eye" id="eyeIcon"></i>
</button>
</div>
</div>
<div class="auth-meta-row">
<label class="auth-remember">
<input type="checkbox" name="remember"> Remember Me
</label>
<a href="forgot-password.php" class="auth-forgot">Forgot Password?</a>
</div>
<button type="submit" class="auth-submit-btn" id="submitBtn">
<span>LOGIN TO ACCOUNT</span> <i class="bi bi-box-arrow-in-right"></i>
</button>
</form>
<p class="auth-switch-text">
New to GyaniGuru by JMC? <a href="register.php" class="auth-switch-link">Create Account</a>
</p>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/aos@2.3.4/dist/aos.js"></script>
<script>
AOS.init();
// Inject Particles
const bg = document.getElementById('authBg');
for(let i=0; i<20; i++){
const p = document.createElement('div');
p.className = 'auth-particle';
p.style.cssText = `
left: ${Math.random()*100}%;
width: ${Math.random()*4+2}px;
height: ${Math.random()*4+2}px;
animation-duration: ${Math.random()*15+10}s;
animation-delay: ${Math.random()*10}s;
`;
bg.appendChild(p);
}
function togglePassword() {
const input = document.getElementById('passwordInput');
const icon = document.getElementById('eyeIcon');
if(input.type === 'password'){
input.type = 'text';
icon.className = 'bi bi-eye-slash';
} else {
input.type = 'password';
icon.className = 'bi bi-eye';
}
}
// Submit Loading Effect
document.getElementById('loginForm').addEventListener('submit', function() {
const btn = document.getElementById('submitBtn');
btn.innerHTML = '<span class="spinner"></span> Authenticating...';
btn.style.pointerEvents = 'none';
btn.style.opacity = '0.8';
});
</script>
</body>
</html>