<?php include_once 'parametros.php'; $DB = new DBPDO(); $sql = "SELECT * FROM usuarios WHERE usuario='" . $_POST['usuario'] . "' AND contrasena='" . md5($_POST['contrasena']) . "'"; $usuarios = $DB->fetch($sql); if (!empty($usuarios)) { setcookie("id_usuario", $usuarios['id']); setcookie("nombre_usuario", $usuarios['nombre']); header('Location: index.php'); } else { header('Location: index.php?err=1'); }
<?php include_once 'parametros.php'; include_once 'class/class.DBPDO.php'; $DB = new DBPDO(); ?> <!DOCTYPE html> <html lang="es"> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> <meta name="robots" content="noindex, nofollow"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Control de Cuentas</title> <link rel="icon" type="image/png" href="favicon.png" /> <script src="js/jquery.min.js"></script> <link rel="stylesheet" href="css/bootstrap.min.css"> <!-- <link rel="stylesheet" href="css/bootstrap.theme.min.css">--> <link rel="stylesheet" href="css/bootstrap.superhero.min.css"> <link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/datepicker.css"> <script src="js/bootstrap.js"></script> <script src="js/bootstrap-datepicker.js"></script> <script src="js/bootstrap-datepicker.es.min.js"></script> <script type="text/javascript"> $(function () { $('.datepicker').datepicker({ format: "yyyy-mm-dd"