function Check($va) { global $scDb; $cUserName = strtolower($va['cUser']); $cPassword = $va['cPassword']; $cPassword = scCrypt::CryptPass($cPassword); $dbData = $scDb->Browse("username", "*", "UserName = '******' and Password like '{$cPassword}%'"); if ($dbRow = $scDb->GetRow($dbData)) { $cNama = "Administrator"; SaveSession("cSession_UserName", $cUserName); SaveSession("cSession_FullName", $dbRow['FullName']); SaveSession("cSession_Foto", $dbRow['Foto']); SaveSession("cSession_UserName_Target", $dbRow['UserName_Target']); //new sc levelup $cLevel = scCrypt::GetLevelPass($dbRow['Password']); SaveSession("cSession_SCLevel", $cLevel); SaveSession("cSession_SCLevelmd5", scSys::GetKeteranganOne("Isi", "Kode = '{$cLevel}'", "username_level")); //update login and last login $vaArray = array("LastLogin" => date("Y-m-d h:i:s")); $scDb->Edit("username", $vaArray, "UserName = '******' and Password like '{$cPassword}%'"); SaveSession("bismillahauth", md5(time() . $cUserName)); //reload me echo ' window.location = "./" ; '; } else { echo ' $("#login.panel .panel-body .error").slideDown(800,function(){ $(this).html("User or Password not found") ; }) ; '; } }
function GetData($va) { global $scDb; $cKode = $va['cUserName']; $dbData = $scDb->Browse("username", "*", "UserName = '******'"); if ($dbRow = $scDb->GetRow($dbData)) { $cLevel = scCrypt::GetLevelPass($dbRow['Password']); $UserName_Target = ""; if ($dbRow['UserName_Target'] !== "") { $UserName_Target = array("id" => $dbRow['UserName_Target'], "text" => scSys::GetKeteranganOne("nama", "nip = '{$dbRow['UserName_Target']}'", "pegawai")); } echo ' with(document.oForm){ cUserName.value = "' . $dbRow['UserName'] . '" ; cUserName.readOnly = 1 ; cFullName.value = "' . $dbRow['FullName'] . '" ; } $("#UserName_Target").select2("data",' . json_encode($UserName_Target) . ') $("#cUserName").select2("data",{id: "' . $dbRow['UserName'] . '", text: "' . $dbRow['UserName'] . '"}) ; $("#cLevel").select2("data",{id: "' . $cLevel . '", text: "' . $cLevel . '"}) ; '; } else { echo ' alert("Data not found ' . $cKode . '") ; scLoadPage("sc-content-load","sys/sysuser_grid.php") ; '; } }
</div> <div class="box-body pad table-responsive"> <table class="table table-striped table-bordered table-hover sc-DataTable" id="sc-DataTable"> <thead> <tr> <td width="100" align="center">UserName</td> <td>FullName</td> <td width="100" align="center">Level</td> <td width="80" align="center">Action</td> </tr> </thead> <tbody> <?php $dbData = $scDb->Browse("username", "*"); while ($dbRow = $scDb->GetRow($dbData)) { $cLevel = scCrypt::GetLevelPass($dbRow['Password']); ?> <tr> <td width="100" align="center"><?php echo $dbRow['UserName']; ?> </td> <td ><?php echo $dbRow['FullName']; ?> </td> <td width="100"> <?php echo scSys::GetKeteranganOne("Keterangan", "Kode = '{$cLevel}'", "username_level"); ?> </td>