This commit is contained in:
Miguel 2025-06-16 11:23:32 -06:00
commit 47a5e8f90b
3 changed files with 53 additions and 10 deletions

View File

@ -24,6 +24,30 @@ if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
<link href="style/dashboard.css" rel="stylesheet">
<style>
body {
display: flex;
}
.sidebar {
min-width: 250px;
height: 145vh;
background: rgb(19, 61, 213);
color: white;
}
.sidebar a {
color: white;
text-decoration: none;
}
.survey img {
cursor: pointer;
transition: transform .1s;
}
.survey img:checked + label img,
.survey input[type="radio"]:checked + label img {
transform: scale(1.2);
}
</style>
>>>>>>> e909e7d2c6185583ff52105c062fd249ed0450b2
</head>
<body class="bg-light">

View File

@ -1,13 +1,3 @@
<?php
session_start(); // Start the session
// Check if the user is not logged in
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
header('Location: login.php'); // Redirect to login page
exit();
}
?>
<!DOCTYPE html>
<html lang="es">
<head>

29
model/inicio.php Normal file
View File

@ -0,0 +1,29 @@
<?php
session_start();
$conn = require_once __DIR__ . '/../database/database.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$nombre = $_POST['nombre'];
$password = $_POST['password'];
$stmt = $conn->prepare("SELECT * FROM admin WHERE nombre = ?");
$stmt->bind_param("s", $nombre);
$stmt->execute();
$result = $stmt->get_result();
if ($admin = $result->fetch_assoc()) {
if (password_verify($password, $admin['password'])) {
$_SESSION['admin'] = $admin['nombre'];
header("Location: dashboard.php");
exit;
} else {
$error = "⚠️ Contraseña incorrecta.";
}
} else {
$error = "⚠️ Usuario no encontrado.";
}
$stmt->close();
}
?>