35273-vm/login.php
Flatlogic Bot a3fa722e5f c3
2025-10-27 12:46:17 +00:00

58 lines
2.5 KiB
PHP

<?php
require_once 'config.php';
include 'header.php';
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$email = $_POST['email'] ?? '';
$password = $_POST['password'] ?? '';
if (empty($email) || empty($password)) {
$error = 'Please fill in both fields.';
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error = 'Please enter a valid email address.';
} else {
// In a real application, you would validate credentials against a database.
// For this demo, we'll just simulate a successful login.
$_SESSION['user_email'] = $email;
header('Location: dashboard.php');
exit;
}
}
?>
<div class="container flex-grow-1">
<div class="row justify-content-center">
<div class="col-md-6 col-lg-5">
<div class="card shadow-lg border-0 rounded-lg mt-5">
<div class="card-header text-center bg-primary text-white">
<h3 class="my-4">Login</h3>
</div>
<div class="card-body p-4">
<p class="text-center text-muted mb-4">Access your E-PRTR+LCP account</p>
<?php if ($error): ?>
<div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div>
<?php endif; ?>
<form action="login.php" method="POST">
<div class="form-floating mb-3">
<input class="form-control" id="inputEmail" type="email" name="email" placeholder="name@example.com" required value="<?php echo isset($_POST['email']) ? htmlspecialchars($_POST['email']) : ''; ?>">
<label for="inputEmail">Email address</label>
</div>
<div class="form-floating mb-3">
<input class="form-control" id="inputPassword" type="password" name="password" placeholder="Password" required>
<label for="inputPassword">Password</label>
</div>
<div class="d-grid mt-4">
<button class="btn btn-primary btn-lg" type="submit">Login</button>
</div>
</form>
</div>
<div class="card-footer text-center py-3">
<div class="small"><a href="index.php">Back to Home</a></div>
</div>
</div>
</div>
</div>
</div>
<?php include 'footer.php'; ?>