[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
Backup
/
05122024
/
htdocs
/
siakad
/
simpeg
/
kepegawaian
/
Setup
/
New folder
/
[
Home
]
File: Userlogin.inc.php
<?php $title = $nmsd." : Userlogin"; // $nmForm = "cp-userlogin.php"; $nmTable = "login_user"; //hak akses $formnama = "cp-userlogin"; $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 = " "; if($hakakses[3] == 0) $bt_multipledelete = " "; $nmForm = "index.php?Userlogin"; //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 $user_id = ""; $user_nama = ""; $user_name = ""; $user_pass = ""; $user_repass = ""; $user_akad = ""; $user_perpus = ""; $user_psb = ""; $id_profil = ""; $alert = 0; //multiple del record if(isset($_POST["Delete"])) { $userid = & $_POST["userid"]; for($a=0,$b=count($userid);$a<$b;$a++) { $exe = _del($nmTable,"user_id",MyIdDecode($userid[$a]),0); } } //cara untuk hapus record if($delete == "active" && isset($_GET["user_id"])) { $exe = _del($nmTable,"user_id",MyIdDecode($_GET["user_id"]),0); echo "<script>window.alert('".$deme."');</script>"; echo "<script>window.parent.document.location.href='".$nmForm."';</script>"; } //cara untuk edit record if($edit == "active" && isset($_GET["user_id"])) { $query = "select * from ".$nmTable." where user_id = ".MyIdDecode($_GET["user_id"]); $iData=sAllData($query); for($a=0,$b=count($iData);$a<$b;$a++) { $user_id = $iData[$a]["user_id"]; $user_nama = $iData[$a]["user_nama"]; $user_name = $iData[$a]["user_name"]; $user_pass = $iData[$a]["user_pass"]; $user_repass = $iData[$a]["user_repass"]; // $user_akad = $iData[$a]["user_akad"]; // $user_perpus = $iData[$a]["user_perpus"]; // $user_psb = $iData[$a]["user_psb"]; $id_profil = $iData[$a]["id_profil"]; $id_siswa = $iData[$a]["id_siswa"]; $id_pgw = $iData[$a]["id_pgw"]; } } //cara untuk simpan if(isset($_POST["Simpan"]) || isset($_POST["Update"])) { $user_nama = $_POST["user_nama"]; $user_name = $_POST["user_name"]; $user_pass = $_POST["user_pass"]; $user_repass = $_POST["user_repass"]; $id_profil = $_POST["id_profil"]; if(isset($_POST["user_akad"])) $user_akad = $_POST["user_akad"]; if(isset($_POST["user_perpus"])) $user_perpus = $_POST["user_perpus"]; if(isset($_POST["user_psb"])) $user_psb = $_POST["user_psb"]; //validasi data tidak boleh ada yg kosong if($user_nama == "") $alert = 1; if($user_name == "") $alert = 1; if($user_pass == "") $alert = 1; if($user_repass == "") $alert = 1; if($id_profil == "") $alert = 1; if($user_pass != $user_repass) $alert = 2; if($alert == 2) { echo "<script>window.alert('Password dan repassword harus sama.');</script>"; }elseif($alert == 1) { echo "<script>window.alert('".$esm1."');</script>"; }else{ $tbField[0] = "user_id"; $tbField[1] = "user_nama"; $tbField[2] = "user_name"; $tbField[3] = "user_pass"; $tbField[4] = "user_repass"; $tbField[5] = "user_akad"; $tbField[6] = "user_perpus"; $tbField[7] = "user_psb"; $tbField[8] = "id_profil"; $tbField[9] = "id_siswa"; $tbField[10] = "id_pgw"; if(isset($_POST["Simpan"])) $user_id = maxId($tbField[0],$nmTable); if(isset($_POST["Update"])) $user_id = $_POST["user_id"]; $tbIsi[0] = $user_id; $tbIsi[1] = "'".addslashes($_POST["user_nama"])."'"; $tbIsi[2] = "'".addslashes($_POST["user_name"])."'"; $tbIsi[3] = "'".addslashes($_POST["user_pass"])."'"; $tbIsi[4] = "'".addslashes($_POST["user_repass"])."'"; $tbIsi[5] = "'0'"; $tbIsi[6] = "'0'"; $tbIsi[7] = "'0'"; $tbIsi[8] = "'".$_POST["id_profil"]."'"; $tbIsi[9] = "'".$_POST["id_siswa"]."'"; $tbIsi[10] = "'".$_POST["id_pgw"]."'"; if(isset($_POST["Simpan"])) { $nmField = compile_array($tbField); $isiField = compile_array($tbIsi); $exe = _ins($nmTable,$nmField,$isiField,0); echo "<script>window.alert('".$ssm."');</script>"; } if(isset($_POST["Update"])) { $compileSet = compile_array2($tbField,$tbIsi); $exe = _upd($nmTable,$compileSet,$tbField[0],$tbIsi[0],0); echo "<script>window.alert('".$sum."');</script>"; } echo "<script>window.parent.document.location.href='".$nmForm."';</script>"; } } ?> <script> function hapus(a) { var user_id = a; if(confirm('Anda akan menghapus data ini, klik OK untuk memprosesnya.')) window.parent.document.location.href='<?php echo $nmForm;?>&delete=active&user_id='+user_id; else return false; } </script> <section id="content" class="content-alt"> <div class="container"> <div class="card"> <div class="card-header"> <h2>Setup Userlogin <small>Form berikut ini berisi tentang entry, edit & hapus untuk semua data 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 width=28%><b>Nama User</b></td>"; echo "<td width=2%>:</td>"; echo "<td width=70%>".iTBox("45","255","user_nama",$user_nama,"style=\"width: 35%;\"")."".iTextH("user_id",$user_id)."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Username</b></td>"; echo "<td>:</td>"; echo "<td>".iTBox("45","255","user_name",$user_name,"style=\"width: 55%;\"")."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Password</b></td>"; echo "<td>:</td>"; echo "<td>".iTBoxPass("45","255","user_pass",$user_pass,"style=\"width: 55%;\"")."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Ulangi</b></td>"; echo "<td>:</td>"; echo "<td>".iTBoxPass("45","255","user_repass",$user_repass,"style=\"width: 55%;\"")."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Profil Pengguna</b></td>"; echo "<td>:</td>"; $cmbox = "<select name=\"id_profil\" class=\"form-control\">"; $query="select * from login_profil order by logprof_id asc"; $iDataArray=sAllData($query); 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 "<tr>"; echo "<td><b>Sebagai Siswa</b></td>"; echo "<td>:</td>"; $cmbox = "<select name=\"id_siswa\" class=\"form-control\">"; $query="select * from m_siswa order by siswa_id asc"; $cmbox .= iComboB(0,0,$id_siswa,""); $iDataArray=sAllData($query); for($a=0,$b=count($iDataArray);$a<$b;$a++) { $cmbox .= iComboB($iDataArray[$a]["siswa_id"],$iDataArray[$a]["siswa_id"],$id_siswa,$iDataArray[$a]["siswa_nama"]); } $cmbox .= "</select>"; echo "<td>".$cmbox."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Sebagai Guru</b></td>"; echo "<td>:</td>"; $cmbox = "<select name=\"id_pgw\" class=\"form-control\">"; $query="select * from m_pegawai order by pgw_id asc"; $cmbox .= iComboB(0,0,$id_pgw,""); $iDataArray=sAllData($query); for($a=0,$b=count($iDataArray);$a<$b;$a++) { $cmbox .= iComboB($iDataArray[$a]["pgw_id"],$iDataArray[$a]["pgw_id"],$id_pgw,$iDataArray[$a]["pgw_nama"]); } $cmbox .= "</select>"; echo "<td>".$cmbox."</td>"; echo "</tr>"; echo "<tr>"; echo "<td> </td>"; echo "<td> </td>"; if($edit) { echo "<td>".iSbmt("Update")."</td>"; }else{ echo "<td>".$bt_simpan."</td>"; } echo "</tr>"; echo "</table>"; ?> <br> <?php echo "<table class=\"table table-hover\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\" margin: 0; width: 100%;\">"; echo "<tr>"; echo "<th width=5% align=center>Hapus</th>"; echo "<th width=5% align=center>Edit</th>"; echo "<th width=30% align=center>Nama User</th>"; echo "<th width=30%>Profil</th>"; echo "</tr>"; $query="select * from ".$nmTable." a left join login_profil b on a.id_profil = b.logprof_id order by user_nama asc"; $iData=sAllData($query); for($a=0,$b=count($iData);$a<$b;$a++) { if($iData[$a]["user_akad"] == "1") $imakad = iPict($icon_people,16,16,""); else $imakad = " "; if($iData[$a]["user_perpus"] == "1") $imperpus = iPict($icon_people,16,16,""); else $imperpus = " "; if($iData[$a]["user_psb"] == "1") $impsb = iPict($icon_people,16,16,""); else $impsb = " "; echo "<tr>"; if($hakakses[3] == 0) echo "<td> </td>"; else{ if(isset($_POST["Multiple"])) echo "<td align=center><input type=checkbox id=userid[] name=userid[] value=".MyIdEncode($iData[$a]["user_id"])."></td>"; else echo "<td align=center>".iAPict("hapus('".MyIdEncode($iData[$a]["user_id"])."');",$icon_del,16,16)."</td>"; } if($hakakses[2] == 0) echo "<td> </td>"; else{ echo "<td align=center>".iAPict2($nmForm."&edit=active&user_id=".MyIdEncode($iData[$a]["user_id"]),$icon_edit,16,16)."</td>"; } echo "<td>".$iData[$a]["user_nama"]." </td>"; echo "<td><a href=\"index.php?UserProfile&logprof_id=".$iData[$a]["logprof_id"]."\">".$iData[$a]["logprof_nama"]."</a> </td>"; echo "</tr>"; } echo "<tr>"; echo "<td colspan=7 align=left>"; if(isset($_POST["Multiple"])) echo iSbmt("Delete"); else echo iSbmt("Multiple"); echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; ?> </div> </div> </div> </section>