Script PHP Session Login Admin

♠ Posted by Unknown at 06.56

 Script PHP Session Login Admin





login_admin.php

<?php

session_start();

if (isset($_POST['login'])) {
  require 'koneksi.php';
  $email = $_POST['email'];
  $password  = $_POST['password'];
  $result = mysqli_query($db, 'SELECT * FROM admin WHERE email="'.$email.'" AND password="'.$password.'"');
  if (mysqli_num_rows($result)==1) {
      $_SESSION['email'] = $email;
        header('Location: admin.php');
  }
  else{
    echo "<script>alert('Your account invalid !')</script>";
  }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Login</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<form method="post">
<div class="border">
<h2>Login Administrator</h2><hr style="width: 70%;"><br>
<h4><img src="images/login.png" alt="admin" class="image" >
<form role="form" >
    <div class="form-group" >
      <div class="col-xs-2">
        <label for="ex1">Email&nbsp&nbsp&nbsp&nbsp&nbsp</label>
        <input class="form-control" id="ex1" type="email" name="email">
      </div><br>
      <div class="col-xs-2" >
        <label for="ex2">Password</label>
        <input class="form-control" id="ex2" type="password" name="password">
      </div><br>
      <a href="admin.php"><button class="button button1" name="login">Login</button></a>
      <a href="index.php"><button class="button button1">Cancel</button></a>
    </div>
  </form>
</h4>

</div>
</body>
</html>


admin.php

<?php
session_start();

if (!isset($_SESSION['email'])) {
    header("Location: login_admin.php");
}

include 'koneksi.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Halaman Admin</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<h1 class="menu">Halaman Admin</h1><hr width="50%">
<a href="tambah_cerita.php"><button class="button button1 button2">Cerita</button></a>
<a href="buku_tamu.php"><button class="button button1 button2">Buku Tamu</button></a>
<h3><a href="login_admin.php">Logout</h3>
</body>
</html>



Maka akan muncul tampilan sebagai berikut.


2 komentar:

Thank you gan

https://ngide.net

Nagaqq Yang Merupakan Agen Bandarq terbaik , Domino 99, Dan Bandar Poker Online Terpercaya di asia hadir untuk anda semua dengan permainan permainan menarik dan bonus menarik untuk anda semua

Bonus yang diberikan NagaQQ :
* Bonus rollingan 0.5%,setiap senin di bagikannya
* Bonus Refferal 10% + 10%,seumur hidup
* Bonus Jackpot, yang dapat anda dapatkan dengan mudah
* Minimal Depo 15.000
* Minimal WD 20.000
* Deposit via Pulsa TELKOMSEL
* 6 JENIS BANK ( BCA , BNI, BRI , MANDIRI , CIMB , DANAMON )

Memegang Gelar atau title sebagai AGEN POKER ONLINE Terbaik di masanya

11 Games Yang di Hadirkan NagaQQ :
* Poker Online
* BandarQ
* Domino99
* Bandar Poker
* Bandar66
* Sakong
* Capsa Susun
* AduQ
* Perang Bacarrat
* Perang Dadu
* BD QQ (New Game)


Info Lebih lanjut Kunjungi :
Website : NAGAQQ
Facebook : NagaQQ official
WHATSAPP : +855977509035
Line : Cs_nagaQQ
TELEGRAM :+855967014811

BACA JUGA BLOGSPORT KAMI YANG LAIN:
Winner NagaQQ
Daftar NagaQQ
nagaqq


Posting Komentar