Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- login.php
- <?php
- session_start();
- if($_POST) {
- $username = trim($_POST['name']);
- $password = trim($_POST['pass']);
- if($username === "admin" && $password === "admin") {
- $_SESSION["authenticated"] = "true";
- header("Location: admin.php");
- }
- else {
- header("Location: login.php?error=1");
- }
- }
- ?>
- <?php if(isset($_GET['error'])): ?>
- <p class="error">Zlé prihlasovacie meno alebo heslo!</p>
- <?php endif; ?>
- <form method="post" action="">
- <p>
- <label for="name">Prihlasovacie meno:</label>
- <input type="text" name="name" id="name" value="<?php if(isset($_POST['name'])) $_POST['name'] ?>" />
- </p>
- <p>
- <label for="pass">Heslo:</label>
- <input type="password" name="pass" id="pass" />
- </p>
- <input type="submit" value="prihlásiť" />
- </form>
- admin.php
Add Comment
Please, Sign In to add comment