Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *admin.php
- *
- * Inloggning
- *
- */
- // header
- require "headermall.php";
- // <div id content
- echo "<div id='content'>\n";
- session_start();
- //anslut.php
- require "anslut.php";
- // inloggningskontroll
- require("messages.php"); //Copywriting
- if ( empty($_POST) ) {
- // Visa formulär för första gången
- $error_message = "";
- include "loginmall.php";
- }
- else {
- //kontrollera uppgifter
- $stmt = $dbh->prepare(
- "SELECT
- username,
- password,
- email,
- realname,
- title
- FROM
- admin
- WHERE
- username = :username AND password = SHA1(:password)");
- $stmt->bindParam('username', $_POST ['username']);
- $stmt->bindParam('password', $_POST ['password']);
- $stmt->execute();
- $fail = !$stmt->fetch ();
- if ($fail) {
- // $login_message = $loginmsg ['fail'];
- include "loginmall.php"; // Visa formulär
- if ( isset ($_SESSION['login'] ) ) {
- unset($_SESSION[$_LOGIN]);
- }
- echo "Du har skrivit in fel lösenord/användarnamn, försök igen!";
- }
- else {
- // Inloggnig lyckad!
- session_regenerate_id();
- $_SESSION['login'] = $_POST['username'];
- header("Location: admin_page_1.php");
- exit;
- }
- }
- // slut på content
- echo "</div>\n";
- require "footermall.php";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement