Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
$privateError = "private";
$noLog = "nolog";
if (isset($_GET["error"]) && $_GET["error"] == $privateError) {
echo "Esto es una zona privada logeate para poder pasar";
} else if (isset($_GET["error"]) && $_GET["error"] == $noLog) {
echo "Rellena correctamente los parametros";
}
?>
<form action="procesador.php" method=POST>
<label for="name">Nombre:</label>
<input id="name" type="text" name="names">
<br>
<label for="password">Contraseña:</label>
<input id="password" type="password" name="passwords">
<br>
<button type="submit">Enviar</button>
</form>

</body>
</html>
4 changes: 4 additions & 0 deletions private.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
session_start();
if (!isset($_SESSION["users"])) header("location:index.php?error=private");
?>
13 changes: 13 additions & 0 deletions procesador.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
$name = "Edgar";
$passwd = "12345";

if ($name == $_REQUEST["names"] && $passwd == $_REQUEST["passwords"]) {
session_start();
$_SESSION["users"] = $_REQUEST["names"];
header("location:index.php?error=nolog");
header("location:private.php");
} else {
header("location:index.php?error=nolog");
}
?>