<?php
session_start();
require('lib/conexion.php');

$posUsuario = $_POST['usr'] ?? '';
$posPass    = $_POST['pass'] ?? '';

if ($con = conectar()) {

    $stmt = $con->prepare(
        "SELECT * FROM uyuo6 WHERE usuario = ? AND password = ?"
    );

    $stmt->bind_param("ss", $posUsuario, $posPass);
    $stmt->execute();
    $resultado = $stmt->get_result();

    if ($resultado->num_rows > 0) {
        $_SESSION["usuario"] = $posUsuario;
        $_SESSION["sesion"]  = "OK";
        echo "OK";
    } else {
        echo "NO";
    }

} else {
    echo "ERR";
}
?>