| Server IP : 103.243.232.44 / Your IP : 216.73.216.237 Web Server : LiteSpeed System : Linux server17213-10344.hostycare.online 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64 User : iamakash ( 1400) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/iamakash/public_html/shaurya.meals28.com/ |
Upload File : |
<?php
require __DIR__ . '/includes/auth.php';
// Already logged in → go to dashboard
if (isLoggedIn()) {
header('Location: ' . base_url('index.php'));
exit;
}
$error = '';
$login_id = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$login_id = trim($_POST['login_id'] ?? '');
$password = $_POST['password'] ?? '';
if ($login_id === '' || $password === '') {
$error = 'Please enter your email (or mobile) and password.';
} else {
$pdo = getPDO();
// Look up by email or mobile
$stmt = $pdo->prepare(
'SELECT id, first_name, last_name, email, mobile, password_hash
FROM users
WHERE email = ? OR mobile = ?
LIMIT 1'
);
$stmt->execute([$login_id, $login_id]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password_hash'])) {
loginUser($user);
$redirect = $_GET['next'] ?? '';
// Whitelist redirect to prevent open redirect
$allowed = ['index.php','upload.php','browse.php','view.php','calculate.php','export.php'];
if ($redirect && in_array(basename($redirect), $allowed, true)) {
header('Location: ' . base_url($redirect));
} else {
header('Location: ' . base_url('index.php'));
}
exit;
} else {
$error = 'Invalid credentials. Please check your email/mobile and password.';
}
}
}
$pageTitle = 'Sign In — Shaurya';
?><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= h($pageTitle) ?></title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--ink: #0f1a14;
--ink-muted: #4a5a52;
--ink-faint: #8a9a90;
--paper: #f7f5f0;
--white: #ffffff;
--sage: #2d5a3d;
--sage-light: #e8f0ea;
--gold: #c8a84b;
--rule: #d8d4cc;
--radius: 4px;
--radius-lg: 12px;
}
body {
font-family: 'DM Sans', sans-serif;
background: var(--paper);
color: var(--ink);
font-size: 1rem;
line-height: 1.7;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem 1.25rem;
}
::selection { background: var(--sage); color: var(--white); }
.auth-wrap {
width: 100%;
max-width: 420px;
}
.auth-brand {
display: flex;
align-items: center;
gap: 10px;
justify-content: center;
margin-bottom: 2rem;
text-decoration: none;
}
.auth-brand-mark {
width: 36px; height: 36px;
background: var(--sage);
border-radius: var(--radius);
display: flex; align-items: center; justify-content: center;
flex-shrink: 0;
}
.auth-brand-mark svg { width: 20px; height: 20px; }
.auth-brand-name {
font-family: 'DM Serif Display', serif;
font-size: 1.35rem;
color: var(--ink);
letter-spacing: -0.02em;
}
.auth-card {
background: var(--white);
border-radius: var(--radius-lg);
box-shadow: 0 4px 24px rgba(15,26,20,0.08);
padding: 2.25rem 2rem;
}
.auth-heading {
font-family: 'DM Serif Display', serif;
font-size: 1.6rem;
color: var(--ink);
margin-bottom: 0.25rem;
}
.auth-subheading {
font-size: 0.875rem;
color: var(--ink-faint);
margin-bottom: 1.75rem;
}
.auth-alert {
font-size: 0.875rem;
padding: 0.65rem 0.9rem;
border-radius: var(--radius);
margin-bottom: 1.25rem;
line-height: 1.5;
}
.auth-alert-success { background: #e8f0ea; color: #1e4029; border: 1px solid #b6d4be; }
.auth-alert-error { background: #fdecea; color: #7a1f1a; border: 1px solid #f5c2bf; }
.form-group { margin-bottom: 1.1rem; }
.form-group label {
display: block;
font-size: 0.8rem;
font-weight: 500;
color: var(--ink-muted);
letter-spacing: 0.04em;
text-transform: uppercase;
margin-bottom: 0.4rem;
}
.form-group input {
width: 100%;
padding: 0.6rem 0.85rem;
border: 1px solid var(--rule);
border-radius: var(--radius);
font-family: 'DM Sans', sans-serif;
font-size: 0.9375rem;
color: var(--ink);
background: var(--white);
transition: border-color 0.2s, box-shadow 0.2s;
outline: none;
}
.form-group input:focus {
border-color: var(--sage);
box-shadow: 0 0 0 3px rgba(45,90,61,0.1);
}
.form-group input::placeholder { color: var(--ink-faint); }
.btn-submit {
width: 100%;
margin-top: 0.5rem;
padding: 0.7rem 1rem;
background: var(--sage);
color: var(--white);
border: none;
border-radius: var(--radius);
font-family: 'DM Sans', sans-serif;
font-size: 0.9375rem;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn-submit:hover { background: var(--ink); }
.auth-footer {
text-align: center;
margin-top: 1.25rem;
font-size: 0.875rem;
color: var(--ink-faint);
}
.auth-footer a { color: var(--sage); text-decoration: underline; text-underline-offset: 3px; }
.auth-footer a:hover { color: var(--ink); }
.auth-divider {
height: 1px;
background: var(--rule);
margin: 1.5rem 0;
}
</style>
</head>
<body>
<div class="auth-wrap">
<a class="auth-brand" href="<?= base_url('index.php') ?>">
<div class="auth-brand-mark">
<svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="2" y="2" width="7" height="7" rx="1" fill="white" opacity="0.9"/>
<rect x="11" y="2" width="7" height="7" rx="1" fill="white" opacity="0.6"/>
<rect x="2" y="11" width="7" height="7" rx="1" fill="white" opacity="0.6"/>
<rect x="11" y="11" width="7" height="7" rx="1" fill="white" opacity="0.9"/>
</svg>
</div>
<span class="auth-brand-name">Shaurya</span>
</a>
<div class="auth-card">
<div class="auth-heading">Welcome back</div>
<div class="auth-subheading">Sign in to Index Factor</div>
<?php if (isset($_GET['registered'])): ?>
<div class="auth-alert auth-alert-success">Account created! You can now sign in.</div>
<?php endif; ?>
<?php if ($error): ?>
<div class="auth-alert auth-alert-error"><?= h($error) ?></div>
<?php endif; ?>
<form method="post" novalidate>
<div class="form-group">
<label for="login_id">Email or Mobile</label>
<input type="text" id="login_id" name="login_id"
value="<?= h($login_id) ?>" required autofocus autocomplete="username"
placeholder="you@example.com or 9876543210">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" autocomplete="current-password" required placeholder="••••••••">
</div>
<button type="submit" class="btn-submit">Sign In</button>
</form>
<div class="auth-divider"></div>
<p class="auth-footer">
Don't have an account? <a href="<?= base_url('signup.php') ?>">Create one</a>
</p>
</div>
</div>
</body>
</html>