

<?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{
  $aksi = "modul/mod_identitas/aksi_identitas.php";

  // mengatasi variabel yang belum di definisikan (notice undefined index)
  $act = isset($_GET['act']) ? $_GET['act'] : ''; 

  switch($act){
    // Tampil identitas
    default:
      $query = "SELECT * FROM identitas LIMIT 1";
      $hasil = mysqli_query($konek, $query);
      $r     = mysqli_fetch_array($hasil);
      
      $twitter_widget = htmlspecialchars($r['twitter_widget']);
      $googlemap      = htmlspecialchars($r['googlemap']);
                                                                     
      echo "<h2>Identitas Web</h2>
     <div class=\"table-responsive\">
          <table class=\"table text-start align-middle table-bordered table-hover mb-0\">
          <tr class=\"text-white\"><td width=\"120\"><b>Nama_Pemilik</b></td><td>:   $r[nama_pemilik]</td></tr>
          <tr class=\"text-white\"><td><b>Judul_Website</b></td>    <td>:   $r[judul_website]</td></tr>
          <tr class=\"text-white\"><td><b>Alamat_Website</b></td>   <td>:   $r[alamat_website]</td></tr>
          <tr class=\"text-white\"><td><b>Meta_Deskripsi</b></td>   <td>:   $r[meta_deskripsi]</td></tr>
          <tr class=\"text-white\"><td><b>Meta_Keyword</b></td>     <td>:   $r[meta_keyword]</td></tr>
          <tr class=\"text-white\"><td><b>Email</b></td>            <td>:   $r[email]</td></tr>
          
          <tr class=\"text-white\"><td><b>Rekening BRI</b></td>            <td>:   $r[facebook]</td></tr>
          
           <tr class=\"text-white\"><td><b>Rekening Mandiri</b></td>            <td>:   $r[twitter_widget]</td></tr>
         <tr class=\"text-white\"><td><b>WhatsApp</b></td>            <td>:   $r[twitter]</td></tr>
          
          <tr class=\"text-white\"><td><b>Alamat</b></td>      <td>:   $r[googleplus]</td></tr>
         <tr class=\"text-white\"><td><b>Google Map</b>       </td><td> : kontennya tidak ditampilkan karena kodenya agak panjang, tapi kodenya bisa dilihat saat Edit Identitas.</td></tr>
         
          </table>
          </div>
          <br/>
          <p><input type=\"button\" value=\"Edit Identitas\" onclick=location.href=\"?module=identitas&act=editidentitas&id=$r[id_identitas]\" class=\"btn btn-sm btn-primary\"></p>";
    break;
  
    case "editidentitas":
      $query = "SELECT * FROM identitas WHERE id_identitas='$_GET[id]'";
      $hasil = mysqli_query($konek, $query);
      $r     = mysqli_fetch_array($hasil);

      echo "<h2>Edit Identitas Web</h2>
          <form method=\"POST\" enctype=\"multipart/form-data\" action=\"$aksi?module=identitas\">
          <input type=\"hidden\" name=\"id\" value=\"$r[id_identitas]\">

<div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">Nama Pemilik</label>

          <div class=\"col-sm-10\">

       <input type=\"text\" name=\"nama_pemilik\" value=\"$r[nama_pemilik]\" class=\"form-control\" style=\"background-color: #fff;\">

</div>
          </div>

<div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">Judul Website</label>

          <div class=\"col-sm-10\">

       <input type=\"text\" name=\"judul_website\" value=\"$r[judul_website]\" class=\"form-control\" style=\"background-color: #fff;\">

</div>
          </div>

<div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">Alamat Website</label>

          <div class=\"col-sm-10\">

       <input type=\"text\" name=\"alamat_website\" value=\"$r[alamat_website]\" class=\"form-control\" style=\"background-color: #fff;\">

</div>
          </div>
<div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">Meta Deskripsi</label>

          <div class=\"col-sm-10\">

        <input type=\"text\" name=\"meta_deskripsi\" value=\"$r[meta_deskripsi]\" class=\"form-control\" style=\"background-color: #fff;\">

</div>
          </div>
<div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">Meta Keyword</label>

          <div class=\"col-sm-10\">

        <input type=\"text\" name=\"meta_keyword\" value=\"$r[meta_keyword]\" class=\"form-control\" style=\"background-color: #fff;\">

</div>
          </div>
<div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">Email</label>

          <div class=\"col-sm-10\">

       <input type=\"text\" name=\"email\" value=\"$r[email]\" class=\"form-control\" style=\"background-color: #fff;\">

</div>
          </div>


<div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">Rekening BRI</label>

          <div class=\"col-sm-10\">

       <input type=\"text\" name=\"facebook\" value=\"$r[facebook]\" class=\"form-control\" style=\"background-color: #fff;\">

</div>
          </div>

<div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">Rekening Mandiri</label>

          <div class=\"col-sm-10\">

       <input type=\"text\" name=\"twitter_widget\" value=\"$r[twitter_widget]\" class=\"form-control\" style=\"background-color: #fff;\">

</div>
          </div>







<div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">WhatsApp</label>

          <div class=\"col-sm-10\">

       <input type=\"text\" name=\"twitter\" value=\"$r[twitter]\" class=\"form-control\" style=\"background-color: #fff;\">

</div>
          </div>
<div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">Alamat</label>

          <div class=\"col-sm-10\">

        <input type=\"text\" name=\"googleplus\" value=\"$r[googleplus]\" class=\"form-control\" style=\"background-color: #fff;\">

</div>
          </div>





  <div class=\"row mb-3\">
                                    <label for=\"inputEmail3\" class=\"col-sm-2 col-form-label\">Google MAP</label>

          <div class=\"col-sm-10\">

          <textarea name=\"googlemap\" cols=\"90\" rows=\"5\" class=\"form-control\" style=\"background-color: #fff;\">$r[googlemap]</textarea>




        

</div>
          </div>






<br/>


<div style=\"text-align: center !important;\">
          <tr><td colspan=\"2\"><input type=\"submit\" value=\"Update\" class=\"btn btn-primary\">
                                <input type=\"button\" value=\"Batal\" onclick=\"self.history.back()\" class=\"btn btn-primary\"></td></tr>
          </div>





         ";
    break;        
  }
}
?>
