cambio majo

This commit is contained in:
Maria Jose 2025-06-17 16:10:31 -06:00
parent 9b697c64e7
commit ae5645d7da
8 changed files with 492 additions and 143 deletions

BIN
assets/inicio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -2,7 +2,7 @@
$host = "localhost";
$user = "root";
$pass = "Starfox19.";
$pass = "Arbolito123.";
$db = "lania";
$conexion = new mysqli($host, $user, $pass, $db);

View File

@ -1,5 +1,4 @@
<?php
// inicio.php
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
@ -11,7 +10,6 @@ if (isset($_GET['action']) && $_GET['action'] === 'logout') {
exit;
}
// Selección de rol
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['role'])) {
session_unset();
$_SESSION['role'] = $_POST['role'];
@ -26,45 +24,154 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['role'])) {
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Inicio - LANIA</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
margin: 0;
height: 100vh;
background: #001f3f; /* azul marino */
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.logo {
max-width: 300px;
width: 100%;
margin-bottom: 2rem;
}
.btn-role {
width: 220px;
margin-bottom: 1rem;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Inicio</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, #7597b4);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
padding: 20px;
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;
max-width: 900px;
width: 100%;
}
.login-image-section {
flex: 1;
background: url('assets/inicio.png') no-repeat center center;
background-size: cover;
min-height: 350px;
display: none;
}
@media (min-width: 768px) {
.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: #484848;
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:rgb(115, 120, 138);
box-shadow: 0 0 0 0.25rem rgba(19, 61, 213, 0.25);
}
.btn-primary, .btn-light {
background-color: #5691cc;
border-color: #99b1c9;
padding: 10px 20px;
font-size: 1.1em;
font-weight: 600;
border-radius: 5px;
transition: all 0.3s ease;
color: white;
}
.btn-primary:hover, .btn-light:hover {
background-color: #3e4c82;
border-color:rgba(10, 36, 138, 0.31);
transform: translateY(-2px); /* Pequeño efecto al pasar el mouse */
}
.btn-outline-light {
background-color: transparent;
color: #133dd5;
border: 1px solid rgb(173, 174, 179);
}
.btn-outline-light:hover {
background-color: #3e4c82;
color: white;
}
.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);
}
.login-logo {
text-align: center;
margin-bottom: 30px;
}
.login-logo img {
max-width: 120px;
height: auto;
}
.btn-role {
width: 100%;
margin-bottom: 1rem;
}
</style>
</head>
<body>
<img src="assets/logo.png" alt="Logo LANIA" class="logo">
<form method="post">
<button type="submit" name="role" value="aspirant" class="btn btn-outline-light btn-role">
Iniciar como Aspirante
</button>
<button type="submit" name="role" value="admin" class="btn btn-light btn-role">
Iniciar como Administrador
</button>
</form>
<div class="login-wrapper">
<div class="login-image-section">
</div>
<div class="login-form-section">
<div class="login-logo">
<img src="assets/logo.png" alt="Logo LANIA" class="img-fluid">
</div>
<h2>Seleccionar tipo de usuario</h2>
<form method="post">
<button type="submit" name="role" value="aspirant" class="btn btn-outline-light btn-role">
<i class="fas fa-user-graduate me-2"></i> Iniciar como Aspirante
</button>
<button type="submit" name="role" value="admin" class="btn btn-primary btn-role">
<i class="fas fa-user-shield me-2"></i> Iniciar como Administrador
</button>
</form>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
</html>

View File

@ -4,12 +4,9 @@ $conn = require_once __DIR__ . '/../database/database.php';
// Si la conexión falló, $conn será false
if (!($conn instanceof mysqli)) {
// error_log('Fallo conexión a BD en register.php');
}
/*
* Registro directo al recibir POST en este archivo
*/
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['nombre'], $_POST['password'])) {
if (!($conn instanceof mysqli)) {
$error = "❌ Error interno de conexión.";

View File

@ -1,10 +1,9 @@
s<?php
require_once 'model/register.php';
<?php
require_once 'model/register.php';
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
// Si ya está logueado como admin
if (isset($_SESSION['admin_logged']) && $_SESSION['admin_logged'] === true) {
header('Location: dashboard.php');
exit;
@ -14,7 +13,7 @@ if (isset($_SESSION['admin_logged']) && $_SESSION['admin_logged'] === true) {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$nombre = $_POST['nombre'];
$password = $_POST['password'];
$res = createAdmin($nombre, $password);
$res = createAdmin($nombre, $password);
if ($res === true) {
$success = 'Administrador registrado correctamente.';
} else {
@ -25,48 +24,167 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Registro Admin</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">
<style>
body {
margin: 0;
height: 100vh;
background: #001f3f;
display: flex;
align-items: center;
justify-content: center;
}
.card {
width: 100%;
max-width: 400px;
padding: 2rem;
border-radius: .75rem;
background: white;
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Registro Admin</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, #7597b4); /* 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('assets/inicio.png') no-repeat center center; /* Asegúrate de que esta ruta sea correcta */
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: #484848; /* 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, .btn-secondary { /* Apply general button styles */
background-color: #5691cc; /* LANIA blue */
border-color:rgb(122, 133, 173);
padding: 10px 20px;
font-size: 1.1em;
font-weight: 600;
border-radius: 5px;
transition: all 0.3s ease;
color: white; /* Text color for primary button */
}
.btn-primary:hover {
background-color: #3e4c82; /* Darker shade on hover */
border-color: #0a248a;
transform: translateY(-2px); /* Pequeño efecto al pasar el mouse */
}
.btn-secondary {
background-color: #6c757d; /* Bootstrap secondary color */
border-color: #6c757d;
}
.btn-secondary:hover {
background-color: #5a6268;
border-color: #545b62;
transform: translateY(-2px);
}
.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="card shadow">
<h1 class="h4 text-center mb-4">Registrar Administrador</h1>
<form method="post">
<label for="nombre" class="form-label">Nombre:</label>
<input type="text" id="nombre" name="nombre" class="form-control" required><br>
<label for="password" class="form-label">Contraseña:</label>
<input type="password" id="password" name="password" class="form-control" required><br>
<div class="d-flex justify-content-between mt-4">
<button type="submit" class="btn btn-primary">Registrar</button>
<a href="sesion.php" class="btn btn-secondary">Ir al Login</a>
</div>
</form>
<?php if (isset($success)): ?>
<div class="alert alert-success mt-3"><?= $success ?></div>
<?php elseif (isset($error)): ?>
<div class="alert alert-danger mt-3"><?= $error ?></div>
<?php endif; ?>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<div class="login-wrapper">
<div class="login-image-section">
</div>
<div class="login-form-section">
<div class="login-logo">
<img src="assets/logo.png" alt="Logo LANIA" class="img-fluid">
</div>
<h2>Registrar Administrador</h2>
<?php if (isset($success)): ?>
<div class="alert alert-success" role="alert"><?= $success ?></div>
<?php elseif (isset($error)): ?>
<div class="alert alert-danger" role="alert"><?= $error ?></div>
<?php endif; ?>
<form method="post">
<div class="mb-3">
<label for="nombre" class="form-label">Nombre:</label>
<div class="input-group">
<span class="input-group-text"><i class="fas fa-user"></i></span>
<input type="text" id="nombre" name="nombre" class="form-control" 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" id="password" name="password" class="form-control" required>
</div>
</div>
<div class="d-flex justify-content-between mt-4">
<button type="submit" class="btn btn-primary">Registrar</button>
<a href="sesion.php" class="btn btn-secondary">Ir al Login</a>
</div>
</form>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
</html>

View File

@ -1,5 +1,5 @@
<?php
require_once 'model/inicio.php';
require_once 'model/inicio.php'; // This might be a typo, usually 'model/register.php' for checkAdmin
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
@ -14,14 +14,13 @@ if (isset($_SESSION['admin_logged']) && $_SESSION['admin_logged'] === true) {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$nombre = $_POST['nombre'];
$password = $_POST['password'];
require_once 'model/register.php';
if (checkAdmin($nombre, $password)) {
require_once 'model/register.php'; // Ensure this is the correct path for checkAdmin
if (checkAdmin($nombre, $password)) { // This function should be defined in model/register.php
$_SESSION['admin_logged'] = true;
$_SESSION['role'] = 'admin';
header('Location: dashboard.php');
exit;
} else {
// En vez de fatal, simple mensaje y form sigue disponible
$error = 'Nombre o contraseña incorrectos.';
}
}
@ -29,48 +28,165 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Inicio de Sesión - Admin</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">
<style>
body {
margin: 0;
height: 100vh;
background: #001f3f;
display: flex;
align-items: center;
justify-content: center;
}
.card {
width: 100%;
max-width: 400px;
padding: 2rem;
border-radius: .75rem;
background: white;
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Inicio de Sesión - Admin - 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, #7597b4); /* Gradiente azul para LANIA */
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
padding: 20px;
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('assets/inicio.png') no-repeat center center; /* Asegúrate de que esta ruta sea correcta */
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: #484848; /* 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, .btn-secondary {
background-color: #5691cc; /* LANIA blue */
border-color:rgb(145, 152, 176);
padding: 10px 20px;
font-size: 1.1em;
font-weight: 600;
border-radius: 5px;
transition: all 0.3s ease;
color: white; /* Text color for primary button */
}
.btn-primary:hover {
background-color: #3e4c82; /* Darker shade on hover */
border-color: #0a248a;
transform: translateY(-2px); /* Pequeño efecto al pasar el mouse */
}
.btn-secondary {
background-color:rgb(236, 173, 65); /* Bootstrap secondary color */
border-color:rgba(184, 191, 197, 0.23);
}
.btn-secondary:hover {
background-color: #5a6268;
border-color: #545b62;
transform: translateY(-2px);
}
.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="card shadow">
<h1 class="h4 text-center mb-4">Sesión Administrador</h1>
<form method="post">
<label for="nombre" class="form-label">Nombre:</label>
<input type="text" id="nombre" name="nombre" class="form-control" required><br>
<label for="password" class="form-label">Contraseña:</label>
<input type="password" id="password" name="password" class="form-control" required><br>
<div class="d-flex justify-content-between mt-4">
<button type="submit" class="btn btn-primary">Iniciar sesión</button>
<a href="registro.php" class="btn btn-secondary">Regist. n. admin</a>
</div>
</form>
<?php if (isset($error)): ?>
<div class="alert alert-danger mt-3"><?= $error ?></div>
<?php endif; ?>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<div class="login-wrapper">
<div class="login-image-section">
</div>
<div class="login-form-section">
<div class="login-logo">
<img src="assets/logo.png" alt="Logo LANIA" class="img-fluid">
</div>
<h2>Inicio de Sesión - Administrador</h2>
<?php if (isset($error)): ?>
<div class="alert alert-danger" role="alert"><?= $error ?></div>
<?php endif; ?>
<form method="post">
<div class="mb-3">
<label for="nombre" class="form-label">Nombre de Usuario</label>
<div class="input-group">
<span class="input-group-text"><i class="fas fa-user"></i></span>
<input type="text" id="nombre" name="nombre" class="form-control" 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" id="password" name="password" class="form-control" required>
</div>
</div>
<div class="d-flex justify-content-between mt-4">
<button type="submit" class="btn btn-primary">Iniciar sesión</button>
<a href="registro.php" class="btn btn-secondary">Registrar nuevo admin</a>
</div>
</form>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
</html>

View File

@ -21,7 +21,6 @@ $role = $_SESSION['role'] ?? null;
<h4>LANIA</h4>
</div>
<ul class="sidebar-menu">
<!-- Solo para administradores -->
<?php if ($role === 'admin'): ?>
<li id="menu-estadisticas"> <a href="dashboard.php">
<span class="menu-icon-wrapper"><i class="fas fa-tachometer-alt"></i></span>

View File

@ -1,5 +1,5 @@
:root {
--primary:rgb(51, 76, 109);
--primary:#334c6d;
--secondary: #6c757d;
--success: #28a745;
--info: #17a2b8;
@ -22,7 +22,7 @@ body {
left: 0;
height: 100vh;
width: 250px;
background:  #37455a;
background: #37455a; /* Este es el color para todo el sidebar */
color: white;
transition: all 0.3s;
z-index: 1000;
@ -31,7 +31,8 @@ body {
.sidebar-header {
color: black;
padding: 20px;
background:#37455a;
/* Elimina o comenta la línea de abajo para que herede el fondo del .sidebar */
/* background:#37455a; */
text-align: center;
}
@ -48,7 +49,7 @@ body {
border-radius: 8px;
margin: 5px 15px;
background-color: transparent;
color:#4a515a;
color:#e0e0e1;
text-decoration: none;
transition: background-color 0.3s ease, color 0.3s ease;
}
@ -187,6 +188,17 @@ body {
height: 300px;
}
.survey label img {
cursor: pointer;
transition: transform 0.2s ease-in-out;
}
.survey input[type="radio"]:checked + label img {
transform: scale(1.4);
border: 2px solid #e6c926af;
border-radius: 50%;
}
@media (max-width: 768px) {
.sidebar {
margin-left: -250px;