diff --git a/1-login.css b/1-login.css new file mode 100644 index 0000000..092fe08 --- /dev/null +++ b/1-login.css @@ -0,0 +1,49 @@ +/* (A) WHOLE PAGE */ +* { + font-family: Arial, Helvetica, sans-serif; + box-sizing: border-box; +} +body { + max-width: 500px; + margin: 0 auto; + padding: 20px; + background: #f7f7f7; +} + +/* (B) LOGIN FORM */ +#login-form { + padding: 20px; + border: 1px solid #ebebeb; + background: #fff; +} +#login-form h1 { + font-size: 1.5em; + margin: 0 0 20px 0; +} +#login-form label, #login-form input { + display: block; + width: 100%; + margin-top: 10px; +} +#login-form label { color: #767676; } +#login-form input { + padding: 10px; + border: 1px solid #adadad; +} +#login-form input[type=submit] { + margin-top: 20px; + border: 0; + color: #fff; + background: #a52323; + cursor: pointer; +} + +/* (C) INVALID LOGIN */ +#login-bad { + padding : 10px; + margin-bottom: 20px; + background: #ffe7e7; + border: 1px solid #ff3e3e; + color: #c10000; + font-weight: bold; +} \ No newline at end of file diff --git a/1-login.php b/1-login.php new file mode 100644 index 0000000..60c4e97 --- /dev/null +++ b/1-login.php @@ -0,0 +1,38 @@ + + + + + <?php echo gettext("Login Page"); ?> + + + + + +
+ + +
+

+ + + + + "> +
+ + + +

© 2013- sur-le-sentier.fr

+ + + \ No newline at end of file diff --git a/2-check.php b/2-check.php new file mode 100644 index 0000000..2cbae74 --- /dev/null +++ b/2-check.php @@ -0,0 +1,32 @@ + "123456", + "jon" => "654321", + "Bruno" => "$2y$10$3yvUbJoB3ZT/H9SdZLxLYuLjFkgbGtlNkfnn2N4IaMvh9gNyZN9d." + ]; + + //echo password_hash("tmyqFG*K-tnMccapTXW3", PASSWORD_DEFAULT); + + + // (B2) CHECK & VERIFY + if (password_verify($_POST["password"], $users[$_POST["user"]])) { + //if (isset($users[$_POST["user"]]) && $users[$_POST["user"]] == $_POST["password"]) { + $_SESSION["user"] = $_POST["user"]; + } + + // (B3) FAILED LOGIN FLAG + if (!isset($_SESSION["user"])) { $failed = true; } +} + +// (C) REDIRECT TO HOME PAGE IF SIGNED IN - SET YOUR OWN ! +if (isset($_SESSION["user"])) { + $page = 'admin.php'; + header("Location: $page"); + exit(); +} \ No newline at end of file diff --git a/3-protect.php b/3-protect.php new file mode 100644 index 0000000..f5c766f --- /dev/null +++ b/3-protect.php @@ -0,0 +1,15 @@ + + + + + + + + + <?php echo gettext('Logged in'); ?> + + + + + + + + + + + +

+ + + + +
+ Base SQLite: ' . $base . ' !
'; + echo '

Base SQLite: ' . __DIR__ . '/' . $base . ' !

'; + } + ?> + + + + + +

+ + + + + + + + + + +

© 2013- sur-le-sentier.fr

+ + + \ No newline at end of file