[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
Backup
/
14082024
/
Data
/
htdocs
/
htdocs
/
siakad
/
kepegawaian
/
Setup
/
New folder
/
[
Home
]
File: UserAccess.inc.php
<?php $nmForm = "index.php?UserAccess"; $title = $nmsd." : Hak Akses"; // $nmForm = "cp-profileaccess.php"; $nmTable = "login_form"; $nmTable2 = "login_profil_akses"; //hak akses $formnama = "cp-profileaccess"; $registerform = lastlogin($_SESSION["user-id"],$formnama); if(isset($_SESSION["id-profil"])) $idlogprof = $_SESSION["id-profil"]; else $idlogprof = 0; if($idlogprof == 0) echo "<script>window.alert('".$lsm."');location.href='index.php';</script>"; $hakakses = cekhakakses($idlogprof,$formnama); if($hakakses[0] == 0) echo "<script>window.alert('".$erme."');location.href='mainform.php';</script>"; if($hakakses[1] == 0) $bt_simpan = " "; //deskripsikan get variabel $edit = ""; if(!isset($_GET["edit"])) $_GET["edit"] = ""; else $edit = $_GET["edit"]; $delete = ""; if(!isset($_GET["delete"])) $_GET["delete"] = ""; else $delete = $_GET["delete"]; //deskripsikan nama variabel $form_id = ""; $form_name = ""; $form_keterangan = ""; $id_profil = ""; $alert = 0; if(isset($_GET["logprof_id"])) $id_profil = $_GET["logprof_id"]; //cara untuk simpan if(isset($_POST["Simpan"])) { $exe = _del($nmTable2,"id_logprof",$_POST["id_profil"],0); $formid = & $_POST["formid"]; for($a=0,$b=count($formid);$a<$b;$a++) { $tbField[0] = "akses_id"; $tbField[1] = "id_logprof"; $tbField[2] = "id_form"; $tbField[3] = "akses_r"; $tbField[4] = "akses_c"; $tbField[5] = "akses_e"; $tbField[6] = "akses_d"; if(isset($_POST["Simpan"])) $akses_id = maxId($tbField[0],$nmTable2); if(isset($_POST["rformid".MyIdDecode($formid[$a])])) $temp_r = $_POST["rformid".MyIdDecode($formid[$a])]; else $temp_r = 0; if(isset($_POST["cformid".MyIdDecode($formid[$a])])) $temp_c = $_POST["cformid".MyIdDecode($formid[$a])]; else $temp_c = 0; if(isset($_POST["eformid".MyIdDecode($formid[$a])])) $temp_e = $_POST["eformid".MyIdDecode($formid[$a])]; else $temp_e = 0; if(isset($_POST["dformid".MyIdDecode($formid[$a])])) $temp_d = $_POST["dformid".MyIdDecode($formid[$a])]; else $temp_d = 0; $tbIsi[0] = $akses_id; $tbIsi[1] = "'".$_POST["id_profil"]."'"; $tbIsi[2] = "'".MyIdDecode($formid[$a])."'"; $tbIsi[3] = "'".$temp_r."'"; $tbIsi[4] = "'".$temp_c."'"; $tbIsi[5] = "'".$temp_e."'"; $tbIsi[6] = "'".$temp_d."'"; if(isset($_POST["Simpan"])) { $nmField = compile_array($tbField); $isiField = compile_array($tbIsi); $exe = _ins($nmTable2,$nmField,$isiField,1); } } echo "<script>window.alert('".$ssm."');</script>"; } ?> <script> function hapus(a) { var form_id = a; if(confirm('Anda akan menghapus data ini, klik OK untuk memprosesnya.')) window.parent.document.location.href='<?php echo $nmForm;?>&delete=active&form_id='+form_id; else return false; } function centangsmw(id) { document.getElementById('rformid'+id).checked = true; document.getElementById('cformid'+id).checked = true; document.getElementById('eformid'+id).checked = true; document.getElementById('dformid'+id).checked = true; } function pilihcentang() { document.getElementById('formid[]').checked = true; alert('ok'); } </script> <section id="content" class="content-alt"> <div class="container"> <div class="card"> <div class="card-header"> <h2>Setup User Access <small>Form berikut ini berisi tentang entry, edit & hapus untuk semua data hak akses tiap pengguna</small></h2> </div> <div class="card-body"> <?php echo "<form name=\"fanform\" method=\"POST\" action=\"".$nmForm."\">"; echo "<table class=\"table table-striped\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\" margin: 0; width: 100%;\">"; echo "<tr>"; echo "<td><b>Pilih Profil</b></td>"; echo "<td>:</td>"; if(isset($_POST["id_profil"])) $id_profil = $_POST["id_profil"]; $cmbox = "<select name=\"id_profil\" onchange=\"this.form.submit();\">"; $query="select * from login_profil order by logprof_id asc"; $iDataArray=sAllData($query); $cmbox .= iComboB("","",$id_profil,"-- Pilih --"); for($a=0,$b=count($iDataArray);$a<$b;$a++) { $cmbox .= iComboB($iDataArray[$a]["logprof_id"],$iDataArray[$a]["logprof_id"],$id_profil,$iDataArray[$a]["logprof_nama"]); } $cmbox .= "</select>"; echo "<td>".$cmbox."</td>"; echo "</tr>"; echo "</table>"; ?> <br> <?php if($id_profil) { ?> <?php echo "<table class=\"table table-hover\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\" margin: 0; width: 100%;\">"; echo "<tr>"; echo "<td colspan=8 align=center>"; echo $bt_simpan; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<th width=5% align=center>Pilih</th>"; echo "<th width=5% align=center>No.</th>"; echo "<th width=25% align=center>Nama Form</th>"; echo "<th width=50%>Keterangan</th>"; echo "<th width=5%>Read</th>"; echo "<th width=5%>Create</th>"; echo "<th width=5%>Edit</th>"; echo "<th width=5%>Delete</th>"; echo "</tr>"; $query = "select * from (select * from ".$nmTable.") as tb1 left join (select * from ".$nmTable2." where id_logprof = ".$id_profil.") as tb2 on a.tb1.form_id = tb2.id_form order by form_name asc"; $iData=sAllData($query); $no = 0; for($a=0,$b=count($iData);$a<$b;$a++) { echo "<tr>"; // if(isset($_POST["Multiple"])) echo "<td align=center><input type=checkbox id=formid[] name=formid[] value=".MyIdEncode($iData[$a]["form_id"])."></td>"; // else echo "<td align=center>".iAPict("hapus('".MyIdEncode($iData[$a]["form_id"])."');",$icon_del,16,16)."</td>"; if($iData[$a]["akses_id"]) $centang = "checked"; else $centang = "checked"; if($iData[$a]["akses_r"]) $rcentang = "checked"; else $rcentang = ""; if($iData[$a]["akses_c"]) $ccentang = "checked"; else $ccentang = ""; if($iData[$a]["akses_e"]) $ecentang = "checked"; else $ecentang = ""; if($iData[$a]["akses_d"]) $dcentang = "checked"; else $dcentang = ""; echo "<td align=center><input type=checkbox id=formid[] name=formid[] value=".MyIdEncode($iData[$a]["form_id"])." ".$centang." onclick=\"centangsmw(".$iData[$a]["form_id"].");\"></td>"; echo "<td>".($a+1)." </td>"; echo "<td>".$iData[$a]["form_name"]." </td>"; echo "<td>".$iData[$a]["form_keterangan"]." </td>"; echo "<td align=center><input type=checkbox id=rformid".$iData[$a]["form_id"]." name=rformid".$iData[$a]["form_id"]." value=1 ".$rcentang."></td>"; echo "<td align=center><input type=checkbox id=cformid".$iData[$a]["form_id"]." name=cformid".$iData[$a]["form_id"]." value=1 ".$ccentang."></td>"; echo "<td align=center><input type=checkbox id=eformid".$iData[$a]["form_id"]." name=eformid".$iData[$a]["form_id"]." value=1 ".$ecentang."></td>"; echo "<td align=center><input type=checkbox id=dformid".$iData[$a]["form_id"]." name=dformid".$iData[$a]["form_id"]." value=1 ".$dcentang."></td>"; echo "</tr>"; } echo "</table>"; echo "</form>"; ?> <?php } ?> </div> </div> </div> </section>