181 lines
6.6 KiB
PHP
181 lines
6.6 KiB
PHP
<?php
|
|
session_start(); // Start the session at the very beginning
|
|
|
|
$error_message = '';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$email = $_POST['email'] ?? '';
|
|
$password = $_POST['password'] ?? '';
|
|
|
|
// Define allowed email domain and password
|
|
$allowed_domain = '@lania.edu.mx';
|
|
$correct_password = '1234';
|
|
|
|
// Validate email and password
|
|
if (str_ends_with($email, $allowed_domain) && $password === $correct_password) {
|
|
// Authentication successful
|
|
$_SESSION['loggedin'] = true;
|
|
$_SESSION['email'] = $email;
|
|
header('Location: dashboard.php'); // Redirect to dashboard
|
|
exit();
|
|
} else {
|
|
// Authentication failed
|
|
$error_message = 'Correo o contraseña incorrectos.';
|
|
}
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Iniciar Sesión - Centro de Certificación LANIA</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
|
|
<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=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
font-family: 'Roboto', sans-serif;
|
|
background: linear-gradient(to right, #eef7ff, #0a248a); /* Gradiente azul para LANIA */
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
min-height: 100vh;
|
|
margin: 0;
|
|
padding: 20px; /* Padding general para pantallas pequeñas */
|
|
box-sizing: border-box;
|
|
}
|
|
.login-wrapper {
|
|
display: flex;
|
|
background-color: #ffffff;
|
|
border-radius: 10px;
|
|
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
|
overflow: hidden; /* Para que las esquinas redondeadas funcionen bien con el contenido */
|
|
max-width: 900px; /* Ancho máximo para el contenedor de login */
|
|
width: 100%;
|
|
}
|
|
.login-image-section {
|
|
flex: 1;
|
|
background: url('img/image.png') no-repeat center center;
|
|
background-size: cover;
|
|
min-height: 350px; /* Altura mínima para la imagen en móvil */
|
|
display: none; /* Ocultar por defecto en móviles */
|
|
}
|
|
@media (min-width: 768px) { /* Mostrar la imagen en pantallas medianas y grandes */
|
|
.login-image-section {
|
|
display: block;
|
|
}
|
|
}
|
|
.login-form-section {
|
|
flex: 1;
|
|
padding: 40px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
}
|
|
.login-form-section h2 {
|
|
margin-bottom: 25px;
|
|
color: #133dd5; /* Color del texto del título */
|
|
text-align: center;
|
|
font-weight: 700;
|
|
}
|
|
.login-form-section .form-label {
|
|
font-weight: 500;
|
|
color: #343a40;
|
|
}
|
|
.login-form-section .form-control {
|
|
border-radius: 5px;
|
|
border: 1px solid #ced4da;
|
|
padding: 10px 15px;
|
|
transition: all 0.3s ease;
|
|
}
|
|
.login-form-section .form-control:focus {
|
|
border-color: #133dd5;
|
|
box-shadow: 0 0 0 0.25rem rgba(19, 61, 213, 0.25);
|
|
}
|
|
.btn-primary {
|
|
background-color: #133dd5; /* LANIA blue */
|
|
border-color: #133dd5;
|
|
padding: 10px 20px;
|
|
font-size: 1.1em;
|
|
font-weight: 600;
|
|
border-radius: 5px;
|
|
transition: all 0.3s ease;
|
|
}
|
|
.btn-primary:hover {
|
|
background-color: #0a248a; /* Darker shade on hover */
|
|
border-color: #0a248a;
|
|
transform: translateY(-2px); /* Pequeño efecto al pasar el mouse */
|
|
}
|
|
.alert {
|
|
margin-top: 20px;
|
|
text-align: center;
|
|
border-radius: 5px;
|
|
font-weight: 400;
|
|
}
|
|
.text-center.mt-4 p {
|
|
color: #6c757d;
|
|
font-size: 0.9em;
|
|
}
|
|
.social-login-buttons .btn {
|
|
border-radius: 50px; /* Botones más redondeados para redes sociales */
|
|
padding: 8px 20px;
|
|
font-size: 0.9em;
|
|
margin: 0 5px;
|
|
transition: all 0.3s ease;
|
|
}
|
|
.social-login-buttons .btn:hover {
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
/* Estilos para el logo o icono */
|
|
.login-logo {
|
|
text-align: center;
|
|
margin-bottom: 30px;
|
|
}
|
|
.login-logo img {
|
|
max-width: 120px; /* Ajusta el tamaño del logo */
|
|
height: auto;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-wrapper">
|
|
<div class="login-image-section">
|
|
</div>
|
|
<div class="login-form-section">
|
|
<div class="login-logo">
|
|
<img src="img/logo.png" alt="Logo LANIA" class="img-fluid">
|
|
</div>
|
|
<h2>Inicio de sesión</h2>
|
|
<?php if ($error_message): ?>
|
|
<div class="alert alert-danger" role="alert">
|
|
<?= $error_message ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<form action="login.php" method="POST">
|
|
<div class="mb-3">
|
|
<label for="email" class="form-label">Correo Electrónico</label>
|
|
<div class="input-group">
|
|
<span class="input-group-text"><i class="fas fa-user"></i></span>
|
|
<input type="email" class="form-control" id="email" name="email" placeholder="tu.correo@lania.edu.mx" required>
|
|
</div>
|
|
</div>
|
|
<div class="mb-4">
|
|
<label for="password" class="form-label">Contraseña</label>
|
|
<div class="input-group">
|
|
<span class="input-group-text"><i class="fas fa-lock"></i></span>
|
|
<input type="password" class="form-control" id="password" name="password" placeholder="Ingresa tu contraseña" required>
|
|
</div>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary d-block mx-auto">Ingresar</button>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|