Website Perpustakaan




                  1. Menu Login




                  2. Menu Awal Admin



1                    3. Menu Input User
 

1                    4.  Keterangan User Dan Admin
 
         

1                    5. Login Sebagai User





1                     6. Tampilan Utama Pada Akun User





       

1   1. Coding index.php

<?php
session_start();
if(!isset($_SESSION['nama'])){
                echo "<script>alert('Silahkan login terlebih dahulu')</script>";
                echo "<meta http-equiv='refresh' content='0; url=../index.php'>";
} else {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sistem Informasi Perpustakaan </title>
<link rel="stylesheet" type="text/css" href="../images/style.css" />
</head>
<body>
<!-- menu main sebagai div Utama -->
<div id="main">
                <!-- menu Header -->
<div id="header">
<img src="../images/ngubeng.jpg" />
</div>
<!-- menu Header -->
<div id="menu-atas">
                <div id="menu_user">
<span><?=$_SESSION['nama'];?></span>
</div>
<div id="menu_tanggal" align="right">
<span><?php
                                                $array_hr= array(1=>"Senin","Selasa","Rabu","Kamis","Jumat","Sabtu","Minggu");
                                                $hr = $array_hr[date('N')];
                                                $tgl= date('j');
                                                $array_bln = array(1=>"Januari","Februari","Maret", "April", "Mei","Juni","Juli","Agustus","September","Oktober", "November","Desember");
                                                $bln = $array_bln[date('n')];
                                                $thn = date('Y');
                                                echo $hr . ", " . $tgl . " " . $bln . " " . $thn . " ";
                                                ?>
</span>
</div>
</div>
<div>
<!-- menu Kiri -->
                <div id="menu-kiri">
                <div id="bg_menu">Menu Utama
                </div>
                <div id="left_menu">
                <a href="index.php" class="menu">&raquo; Home </a><br />
                <a href="?page=buku" class="menu">&raquo; Buku </a><br />
                <a href="?page=anggota" class="menu">&raquo; Anggota </a><br />
                <a href="?page=transaksi" class="menu">&raquo; Transaksi </a><br />
<a href="?page=laporan" class="menu">&raquo; Laporan </a><br />
<a href="?page=user" class="menu">&raquo; User </a><br />
<a href="../logout.php" class="menu">&raquo; Logout </a><br />
</div>
</div>
                <?php
   error_reporting(0);
   switch($_GET['page'])
                                                     {
                                                                                                default:
                                                                                                include "../home.php";
                                                                                                break;
                                                                                               
                                                                                                // menu buku                                                   
                                                                                                case "buku";
                                                                                                include "buku_data.php";
                                                                                                break;
                                                                                                case "detil-buku";
                                                                                                include "buku_detil.php";
                                                                                                break;
                                                                                                case "buku_input";
                                                                                                include "buku_input.php";
                                                                                                break;
                                                                                                case "buku_proses";
                                                                                                include "buku_proses.php";
                                                                                                break;
                                                                                                case "buku_search";
                                                                                                include "buku_search.php";
                                                                                                break;
                                                                                                case "buku_edit";
                                                                                                include "buku_edit.php";
                                                                                                break;
                                                                                                case "buku_proses_edit";
                                                                                                include "buku_proses_edit.php";
                                                                                                break;
                                                                                                case "buku_hapus";
                                                                                                include "buku_hapus.php";
break;
                                                                                                // anggota
                                                                                                case "anggota";
                                                                                                include "anggota_data.php";
                                                                                                break;
                                                                                                case "anggota_detil";
                                                                                                include "anggota_detil.php";
                                                                                                break;
                                                                                                case "anggota_input";
                                                                                                include "anggota_input.php";
                                                                                                break;
                                                                                                case "anggota_proses";
                                                                                                include "anggota_proses.php";
                                                                                                break;
                                                                                                case "anggota_search";
                                                                                                include "anggota_search.php";
                                                                                                break;
                                                                                                case "anggota_edit";
                                                                                                include "anggota_edit.php";
                                                                                                break;
                                                                                                case "anggota_proses_edit";
                                                                                                include "anggota_proses_edit.php";
                                                                                                break;
                                                                                                case "anggota_hapus";
                                                                                                include "anggota_hapus.php";
                                                                                                break;
                                                                                                // transaksi
                                                                                                case "transaksi";
                                                                                                include "../transaksi_data.php";
                                                                                                break;
                                                                                                case "transaksi_input";
                                                                                                include "../transaksi_input.php";
                                                                                                break;
                                                                                                case "transaksi_proses";
                                                                                                include "../transaksi_proses.php";
                                                                                                break;
                                                                                                case "transaksi_search";
                                                                                                include "../transaksi_search.php";
                                                                                                break;
                                                                                                case "transaksi_proses_kembali";
                                                                                                include "../transaksi_proses_kembali.php";
                                                                                                break;
                                                                                                case "transaksi_proses_perpanjang";
                                                                                                include "../transaksi_proses_perpanjang.php";
                                                                                                break;
                                                                                               
                                                                                               
                                                                                                // laporan
                                                                                                case "laporan";
                                                                                                include "../laporan.php";
                                                                                                break;
                                                                                                // User
                                                                                                case "user";
                                                                                                include "user_data.php";
                                                                                                break;
                                                                                                case "user_search";
                                                                                                include "user_search.php";
                                                                                                break;
                                                                                                case "user_input";
                                                                                                include "user_input.php";
                                                                                                break;
                                                                                                case "user_proses";
                                                                                                include "user_proses.php";
                                                                                                break;
                                                                                                case "user_detil";
                                                                                                include "user_detil.php";
                                                                                                break;
                                                                                                case "user_edit";
                                                                                                include "user_edit.php";
                                                                                                break;
                                                                                                case "user_proses_edit";
                                                                                                include "user_proses_edit.php";
                                                                                                break;
                                                                                                case "user_hapus";
                                                                                                include "user_hapus.php";
                                                                                                break;
}
?>
</div>
<!-- menu Merapikan div content -->
<div class="clear">
                </div>
<!-- menu Footer -->
<div id="footer"><center>Ryan Muhammad yusuf &copy; 2015</center></div>
</div>
</body>
</html>
<?php } ?>

2   2. Coding Login.php

<?php
include 'conn/koneksi.php';
if(isset($_POST['log'])) {
                $user = mysql_real_escape_string($_POST['user']);
                $pass = mysql_real_escape_string($_POST['pass']);
                $pass = md5($pass);
                $sql = mysql_query("SELECT * FROM tbl_user where username='$user' and password='$pass'");
                $data = mysql_fetch_array($sql);
                $username = $data['username'];
                $nama = $data['nama'];
                $password = $data['password'];
                $level = $data['level'];
                if ($user==$username && $pass==$password) {
                                session_start();
                                $_SESSION['nama']=$nama;
                                $_SESSION['level']=$level;
                                if ($level=='admin') {
                                                echo "<script>alert('Anda berhasil Log In. Sebagai : $level');</script>";
                                                echo "<meta http-equiv='refresh' content='0; url=admin/index.php'>";
                                }
                                else {
                                                echo "<script>alert('Anda berhasil Log In. Sebagai : $level');</script>";
                                                echo "<meta http-equiv='refresh' content='0; url=guest/index.php'>";
               
                                }
                } else {
                                                echo "<meta http-equiv='refresh' content='0; url=index.php'>";
                                                echo "<script>alert('Username dan password anda salah, Silahkan login kembali !');</script>";
                }
               
               
}

?>

3   3. Koneksi.php

<?php

$db_host             = "localhost";
$db_user             = "root";
$db_pass             = "";
$db_name          = "db_perpus";

$konek = mysql_connect($db_host,$db_user,$db_pass,$db_name) or die ("Gagal koneksi ke server");
mysql_select_db($db_name, $konek) or die ("Gagal mengaktifkan database".mysql_error());

$denda1=2000;
?>
       <!-- menu tengah -->
    <div id="menu-tengah">
        <div id="bg_menu"><marquee>Welcome to Sistem Informasi Perpustakaan</marquee>
        </div>
        <div id="content_menu">
        <div id="menu_header2">
       
        <center>
        ~ Silahkan pilih Panel Dibawah ini ~
        </center>
       
        </div>
       
        <div class="table_home">
          <table width="100%" height="100%" align="center" cellpadding="2" border="0">
              <tbody>
                <tr>
                    <td class="img_home" align="center"><a href="?page=buku"><img src="../images/buku.png" width="100" height="100"></a><br />
                    <center>Data Buku</center></td>
                    <td class="img_home" align="center"><a href="?page=anggota"><img src="../images/anggota.png" width="100" height="100"></a><br /><center>Anggota</center></td>
                    <td class="img_home" align="center"><a href="?page=transaksi"><img src="../images/user.ico" width="100" height="100"></a></a><br /><center>Transaksi</center></td>
                    <td class="img_home" align="center"><a href="?page=laporan"><img src="../images/laporan.png" width="100" height="100"></a><br /><center>Laporan</center></td>
                   
                </tr>
           
            </tbody>
          </table> 
          </div>
           
      </div>
    </div>

4. Coding Home.php

<div id="menu-tengah">
    <div id="bg_menu"><marquee>Welcome to Sistem Informasi Perpustakaan</marquee>
    </div>
    <div id="content_menu">
        <div id="menu_header2">
     
        <center>
        ~ Silahkan pilih Panel Dibawah ini ~
        </center>
     
        </div>
     
<div class="table_home">
          <table width="100%" height="100%" align="center" cellpadding="2" border="0">
          <tbody>
            <tr>
                <td class="img_home" align="center"><a href="?page=buku"><img src="../images/buku.png" width="100" height="100"></a><br />
                    <center>Data Buku</center></td>
                    <td class="img_home" align="center"><a href="?page=anggota"><img src="../images/anggota.png" width="100" height="100"></a><br /><center>Anggota</center></td>
                    <td class="img_home" align="center"><a href="?page=transaksi"><img src="../images/user.ico" width="100" height="100"></a></a><br /><center>Transaksi</center></td>
                    <td class="img_home" align="center"><a href="?page=laporan"><img src="../images/laporan.png" width="100" height="100"></a><br /><center>Laporan</center></td>
                 
                </tr>
             
         
            </tbody>
          </table>
          </div>
         
 </div>

    </div>

5. Coding Logout.php

<?php
session_start();
echo "<script>alert('Anda berhasil Logout');</script>";
echo "<meta http-equiv='refresh' content='0; url=index.php'>";
session_destroy();
?>

Ryan Muhammad Yusuf
Gugun Hendrawan

0 Komentar untuk "Website Perpustakaan"

Silakan tinggalkan komentar anda. DILARANG KERAS menyimpan link blog/web pada komentar dengan tujuan backlink, Spam.

 
Copyright © 2014 Tutorial Kampus - All Rights Reserved
Template By. Catatan Info