Postingan lainnya
MEMBATASI HAK ACCSES PADA LEVEL USER
Cara membatasi hak accses si user biat gak bisa edit salah satu halaman bagaimana ya,,,???
9 Jawaban:
Natif kayaknya soalnya saya download source code di internet
hmm begitu ya, klo begitu tinggal kasih kolom level pada table usernya
kasih kolom level di table usernya trus tinggal di kasih kondisi kak = kalo field level pada table user = 1 dia bisa menghapus dan edit terkecuali level 2 dia hanya bisa lihat
semoga membantu kak, saya juga masih belajar :D
@hendro Bukan framework mas,,,, pake source kode PHP
@tejo Hehehehe,,,, sama gan ane masi rada2 binggung hee :) ini contoh scripnya gan yang ane pengen buat biar user ga bisa tambah
<?php
session_start();
require_once('../../config/koneksi.php');
require_once('class.customer.php');
$cust = new customer($pdo);
if(!empty($_POST['customer'])){
$kategori = $_POST['kategori'];
$customer = $_POST['customer'];
$alamat = $_POST['alamat'];
$tlpn = $_POST['tlpn'];
$email = $_POST['email'];
$created_by = $_SESSION['s_user'];
if($cust->create($kategori,$customer,$alamat,$tlpn,$email,$created_by)){
$sg = "ok";
$msg1 = "Data telah ditambahkan";
$alert='alert-success';
}else{
$g = "err";
$msg2 = "Data tidak bisa dimasukan";
$alert='alert-error';
}
}
?>
<form id="forms" method="post" onSubmit="return submitForm('<?php echo $_SERVER['PHP_SELF']; ?>')" class="form-horizontal">
<fieldset>
<legend>Tambah Pekerjaan</legend>
<span>
<?php
if(isset($sg) and $sg=='ok'){
echo "
<div class='alert $alert'>
<button type='button' class='close' data-dismiss='alert'>×</button>
$msg1
</div>";
}elseif(isset($sg) and $sg=='err'){
echo "
<div class='alert $alert'>
<button type='button' class='close' data-dismiss='alert'>×</button>
$msg2
</div>";}
?>
</span>
<div class="row-fluid">
<div class="span6">
<div class="control-group">
<label class="control-label"> Kategori</label>
<div class="controls">
<select name="kategori" id="kategori" required class="chzn-select" data-placeholder="Pilih kategori.............">
<option value=""></option>
<option value="Animasi">Animasi</option>
<option value="Modeling">Modeling</option>
<option value="Still Images">Still images</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="customer" >Nama</label>
<div class="controls">
<input type="text" id="customer" name="customer" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="alamat" >Keterangan</label>
<div class="controls">
<textarea class="span8" id="alamat" name="alamat" required placeholder="Keterangan Project"></textarea>
</div>
</div>
</div>
<div class="span6">
<div class="control-group">
<label class="control-label" for="tlpn" >Vendor</label>
<div class="controls">
<input type="text" id="tlpn" name="tlpn" autocomplete="off" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail" >QC</label>
<div class="controls">
<input type="text" id="" name="email" autocomplete="off">
</div>
</div>
</div>
</div>
<div class="form-actions">
<div class="controls">
<button type="submit" class="btn btn-primary">Tambah</button>
<button type="button" id="close" class="btn btn-primary" >Tutup</button>
</div>
</div>
</fieldset>
</form>
<script type="text/javascript">
$(document).ready(function(){
$("#close").click(function(){
$("#form-nest").hide("slow");
});
$(".chzn-select").chosen();
});
</script>
Jawaban Terpilih
coba pelajari di php artisan make:auth