Commit inicial

This commit is contained in:
2024-08-02 12:02:25 -06:00
commit ff7d678844
267 changed files with 101936 additions and 0 deletions

40
action/action_login.php Normal file
View File

@@ -0,0 +1,40 @@
<?php
/*
* Valida usuario con la BD y devuelve contraseña para validar con PHP
*
* Recibe:
* POST: usuario, password
*
* Error:
* 0 - No se recibieron datos
* 1 - Usuario/Contraseña incorrectos
* 2 - Usuario no esta en BD
* 3 - No existe usuario
*
* Success:
* Redirecciona a inicio.php
*/
include_once "../include/nocache.php"; //continue on error
$ruta = "../";
require_once "../include/bd_pdo.php"; //die on error
require_once "../class/c_login.php";
require_once "../include/util.php";
if (!isset($_POST["username"]) || !isset($_POST["passwd"]))
die(header("Location: ../index.php?error=0"));
$usr = trim(filter_input(INPUT_POST, "username")); //limpia texto
$pass = $_POST["passwd"];
$user = Login::validUser($usr, $pass);
if (is_array($user)) {
$_SESSION['error'] = true;
$params = http_build_query($user);
header("Location: ../index.php?$params");
} else {
$_SESSION['user'] = serialize($user);
header("Location: ../main.php");
}
exit;