<?php
// Apabila user belum login
if (empty($_SESSION['namauser']) AND empty($_SESSION['passuser'])){
  echo "<link href=\"css/style_login.css\" rel=\"stylesheet\" type=\"text/css\" />
        <div id=\"login\"><h1 class=\"fail\">Untuk mengakses modul, Anda harus login dulu.</h1>
        <p class=\"fail\"><a href=\"index.php\">LOGIN</a></p></div>";  
}
// Apabila user sudah login dengan benar, maka terbentuklah session

else{
  include "../config/koneksi.php";
  include "../config/library.php";

  // Home (Beranda)
  if ($_GET['module']=='beranda'){               
    if ($_SESSION['leveluser']=='admin' OR $_SESSION['leveluser']=='user'){
      include "modul/mod_beranda/beranda.php";
    }  
  }

  // Identitas Website
  elseif ($_GET['module']=='identitas'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_identitas/identitas.php";
    }
  }

  // Manajemen User
  elseif ($_GET['module']=='user'){
    if ($_SESSION['leveluser']=='admin' OR $_SESSION['leveluser']=='user'){
      include "modul/mod_user/user.php";
    }
  }

  // Manajemen Modul
  elseif ($_GET['module']=='modul'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_modul/modul.php";
    }
  }
  
  // Manajemen Modul
  elseif ($_GET['module']=='kontak'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_kontak/kontak.php";
    }
  }

  // Kategori
  elseif ($_GET['module']=='kategori'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_kategori/kategori.php";
    }
  }

 

  // Banner
  elseif ($_GET['module']=='banner'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_banner/banner.php";
    }
  }
  
   elseif ($_GET['module']=='profil'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_profil/profil.php";
    }
  }
  
  elseif ($_GET['module']=='layanan'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_layanan/layanan.php";
    }
  }
  
  elseif ($_GET['module']=='blog'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_blog/blog.php";
    }
  }
  
  elseif ($_GET['module']=='faq'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_faq/faq.php";
    }
  }
  
  
  
  // Templates
  elseif ($_GET['module']=='templates'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_templates/templates.php";
    }
  }

 
  // Galeri Foto
  elseif ($_GET['module']=='galerifoto'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_galerifoto/galerifoto.php";
    }
  }

  // Menu Website
  elseif ($_GET['module']=='menu'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_menu/menu.php";
    }
  }


  // Video
  elseif ($_GET['module']=='video'){
    if ($_SESSION['leveluser']=='admin'){
      include "modul/mod_video/video.php";
    }
  }



  // Apabila modul tidak ditemukan
  else{
    echo "<p>Modul tidak ada.</p>";
  }
}
?>
