Download login.php from mrsgradenko/files: direct link, hf CLI and curl.
- Browser
- Download file 2.65 kB
-
https://huggingface.co/mrsgradenko/files/resolve/main/login.php
- Command line
-
hf download hf://mrsgradenko/files/login.php
-
curl -L -o login.php https://huggingface.co/mrsgradenko/files/resolve/main/login.php
2.65 kB
| session_start(); | |
| // Si ya hay sesión activa, redirige | |
| if (isset($_SESSION['usuario']) && isset($_SESSION['clave'])) { | |
| header("Location: bienvenido.php"); | |
| exit(); | |
| } | |
| $error = ""; // Variable para mostrar mensaje de error | |
| // Si se envió el formulario | |
| if ($_SERVER['REQUEST_METHOD'] == 'POST') { | |
| $usuario = $_POST['usuario']; // ← Aquí se obtiene el usuario del formulario | |
| $clave = $_POST['clave']; // ← Aquí se obtiene la clave del formulario | |
| // Validar usuario y clave fijos | |
| if ($usuario === 'admin' && $clave === '1234') { //Usuario y contraseña | |
| // Guardar en variables de sesión | |
| $_SESSION['usuario'] = $usuario; | |
| $_SESSION['clave'] = $clave; | |
| // Redirigir | |
| header("Location: bienvenido.php"); | |
| exit(); | |
| } else { | |
| $error = "⚠ Usuario o contraseña incorrectos."; | |
| } | |
| } | |
| <!DOCTYPE html> | |
| <html lang="es"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Iniciar Sesión</title> | |
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"> | |
| </head> | |
| <body class="bg-light"> | |
| <div class="container mt-5"> | |
| <div class="row justify-content-center"> | |
| <div class="col-md-4"> | |
| <div class="card shadow-lg rounded-4"> | |
| <div class="card-body"> | |
| <h3 class="text-center mb-4">Iniciar Sesión</h3> | |
| <!-- Mostrar error si existe --> | |
| <?php if ($error): ?> | |
| <div class="alert alert-danger text-center py-2"> | |
| <?php echo $error; ?> | |
| </div> | |
| <?php endif; ?> | |
| <form method="POST" action=""> | |
| <div class="mb-3"> | |
| <label for="usuario" class="form-label">Usuario</label> | |
| <input type="text" class="form-control" name="usuario" id="usuario" required> | |
| </div> | |
| <div class="mb-3"> | |
| <label for="clave" class="form-label">Clave</label> | |
| <input type="password" class="form-control" name="clave" id="clave" required> | |
| </div> | |
| <div class="d-grid"> | |
| <button type="submit" class="btn btn-primary">Iniciar Sesión</button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| <p class="text-center text-muted mt-3">© <?php echo date("Y"); ?> - Sistema de Sesión</p> | |
| </div> | |
| </div> | |
| </div> | |
| </body> | |
| </html> |