setelah selesai membuat halaman front-end, kali ini kita akan membuat halaman admin, pada video kali ini akan diajarkan cara membuat halaman login untuk administrator
#login.php
<?php session_start(); include "../koneksi.php"; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <link href="../theme.css" rel="stylesheet" type="text/css"> </head> <body> <?php $proses=mysql_real_escape_string(@$_GET['proses']); if($proses=="login"){ $username=mysql_real_escape_string(@$_POST['username']); $password=mysql_real_escape_string(@$_POST['password']); $cekakun=mysqli_num_rows(mysqli_query($koneksi,"SELECT * FROM admin WHERE username='$username' AND password='$password'")); if($cekakun!=0){ $_SESSION['username']=$username; $_SESSION['password']=$password; header("Location: index.php"); echo "<h3>Sukses!! Login Berhasil</h3>"; }else{ echo "<h3>Maaf!! Anda Gagal Login, Silahkan Coba Kembali</h3>"; } } ?> <div class="container"> <form method="post" action="?proses=login"> <h1>Halaman Login Admin</h1> <div class="row"> <label>Username</label> <input type="text" name="username" placeholder="Masukkan Username"> </div> <div class="row"> <label>Password</label> <input type="password" name="password" placeholder="Masukkan Kata Sandi"> </div> <button type="submit">Login Admin</button> </form> </div> </body> </html>
#index.php
<?php session_start(); include "../koneksi.php"; $cekuserlogin=$_SESSION['username']; ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <link href="../theme.css" rel="stylesheet" type="text/css"> </head> <body> <?php if(empty($cekuserlogin)){ header("Location: login.php"); } else{ ?> <div class="menu-atas"> </div> <div class="header"> <div class="row"> <div class="col-4">header Website</div> <div class="col-8"> <a href="./" class="menu-style">Beranda</a> <a href="?page=manajemen_produk" class="menu-style">Manajemen Produk</a> <a href="?page=manajemen_akun" class="menu-style">Manajemen Akun</a> <a href="logout.php" class="menu-style">Logout</a> </div> </div> </div> <div class="row"> <?php $page=mysql_real_escape_string(@$_GET['page']); if($page=="manajemen_produk"){ include "page/manajemen_produk.php"; }elseif($page=="manajemen_akun"){ include "page/manajemen_akun.php"; }else{ include "page/home.php"; } ?> </div> <?php } ?> </body> </html>
Supported by CV. FR-SYSTEM | FRWEBHOST © 2019
Informasi Lengkap Hubungi 081271245514
Mau dapat ilmu-ilmu baru dari FR-ACADEMY?
Yuk kakak ganteng n cantik isi formulir ini.
kamu akan mendapat Ilmu baru yang akan dikirim ke emailmu
setiap ada update dari situs ini
GRATIS
Terima Kasih Kakak, Subscribe telah Berhasil
There was an error while trying to send your request. Please try again.