Manejo de secciones

Validación de Usuarios: validar.php <!DOCTYPE html> <html lang="es"> <head> <title>Validando usuarios en PHP</title> <meta charset="UTF-8"> <link rel="stylesheet" href="./css-login-form/css/style.css"> </head> <body> <?php session_start(); if (!isset($_SESSION['usuario'])) { if (isset($_POST['nombre']) && isset($_POST['clave'])) { if (($_POST['nombre']=="admin")&&($_POST['clave']=="123") )// Tambien puede recibir parámetros desde BD { session_start(); $_SESSION['usuario']=$_POST['nombre']; $_SESSION['tiempo']=time(); header("location:home.php"); }else{ header("location:validar.php"); } } else { ?> <form action="validar.php" method="POST"> <h1>Entrar al sistema</h1> <div class="inset"> <p> <label for="email">Nombre de usuario</label> <input type="text" name="nombre"" id="nombre"/> </p> <p> <label for="password">Contraseña</label> <input type="password" name="clave" id="clave"/> </p> <p> <input type="checkbox" name="remember" id="remember"> <label for="remember">Remember</label> </p> </div> <p class="p-container"> <span>Olvide mi contraseña</span> <input type="submit" name="go" id="go" value="Acceder"/> </p> </form> <?php } }else{ header("location:indexx.php"); } ?> </body> </html> ******************************************************************************************************************* seguridad.php <?php session_start(); if (!isset($_SESSION['usuario'])) header("location:validar.php"); ?> ****************************************************************************************************************** home.php //Luego de tener nuestro validar y seguridad sera llamar en cada archivo visual a seguridad como se muetra <html> <head> <title>Menu de Opciones </title> </head> <body class="homepage"> <?php include ("seguridad.php");//validamos ?> . . .

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.