add rssa-pintar to git
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
class M_hakakses extends CI_Model {
|
||||
|
||||
function prosesedithakakses() {
|
||||
$this->db->where('mum_tipeuser_id', $this->input->post('id'));
|
||||
$this->db->delete('master_user_menu');
|
||||
|
||||
if(isset($_POST['akses'])){
|
||||
$postakses= $_POST['akses'];
|
||||
foreach($postakses as $key1 =>$valueakses)
|
||||
{
|
||||
$tambahaction=null;
|
||||
$editaction=null;
|
||||
$deleteaction=null;
|
||||
$dataakses= explode ("-",$valueakses);
|
||||
|
||||
if(isset($_POST['tambah'])){
|
||||
$posttambah= $_POST['tambah'];
|
||||
foreach($posttambah as $key2 =>$valuetambah)
|
||||
{
|
||||
if($dataakses[1]==$valuetambah){
|
||||
$tambahaction="tambah";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['edit'])){
|
||||
$postedit= $_POST['edit'];
|
||||
foreach($postedit as $key3 =>$valueedit)
|
||||
{
|
||||
if($dataakses[1]==$valueedit){
|
||||
$editaction="ubah";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['delete'])){
|
||||
$postdelete= $_POST['delete'];
|
||||
foreach($postdelete as $key4 =>$valuedelete)
|
||||
{
|
||||
if($dataakses[1]==$valuedelete){
|
||||
$deleteaction="hapus";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_POST['view'])){
|
||||
$postview= $_POST['view'];
|
||||
foreach($postview as $key5 =>$valueview)
|
||||
{
|
||||
if($dataakses[1]==$valueview){
|
||||
$viewaction="lihat";
|
||||
}
|
||||
}
|
||||
}
|
||||
$insert_hakakses = array(
|
||||
'mum_tipeuser_id' => $this->input->post('id'),
|
||||
'mum_menu_id' => $dataakses[1],
|
||||
'mum_lihat' => $viewaction,
|
||||
'mum_tambah' => $tambahaction,
|
||||
'mum_ubah' => $editaction,
|
||||
'mum_hapus' => $deleteaction,
|
||||
);
|
||||
|
||||
$insert = $this->db->insert('master_user_menu', $insert_hakakses);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class M_login extends CI_Model{
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
}
|
||||
public function validate(){
|
||||
$username = $this->security->xss_clean($this->input->post('username'));
|
||||
$password = md5($this->security->xss_clean($this->input->post('password')));
|
||||
$this->db->where('mu_nama_user', $username);
|
||||
$this->db->where('mu_password', $password);
|
||||
$query = $this->db->get('master_user');
|
||||
if($query->num_rows() == 1)
|
||||
{
|
||||
|
||||
$row = $query->row();
|
||||
$data = array(
|
||||
's_ID_User_suratpnm' => $row->mu_id,
|
||||
's_FK_TipeUser_suratpnm' => $row->mu_tipeuser_id,
|
||||
'validated' => true
|
||||
);
|
||||
$this->session->set_userdata($data);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
class M_masteruser extends CI_Model {
|
||||
function index() {
|
||||
$this->db->select('user.*,tipeuser.Nama_TipeUser');
|
||||
$this->db->from('user')->join('tipeuser', 'user.FK_TipeUser = tipeuser.ID_TipeUser', 'left');
|
||||
$query = $this->db->get();
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$insert_masteruser = array(
|
||||
'FK_TipeUser' => $this->input->post('tipeuser'),
|
||||
'NamaUser_User' => $this->input->post('namauser'),
|
||||
'Password_User' => "simkoprasiBMB",
|
||||
'NamaLengkap_User' => $this->input->post('namalengkapuser'),
|
||||
'Telepon_User' => $this->input->post('teleponuser'),
|
||||
'Email_User' => $this->input->post('emailuser'),
|
||||
'TanggalLahir_User' => $this->input->post('tanggallahiruser'),
|
||||
'TempatLahir_User' => $this->input->post('tempatlahiruser'),
|
||||
'Alamat_User' => $this->input->post('alamatuser'),
|
||||
'JenisKelamin_User' => $this->input->post('jeniskelaminuser'),
|
||||
'Agama_User' => $this->input->post('agamauser'),
|
||||
'TanggalBuat_User' => date('Y-m-d H:i:s'),
|
||||
'TanggalEdit_User' => date('Y-m-d H:i:s'),
|
||||
'Provinsi_ID' => $this->input->post('provinsi'),
|
||||
'Kabupaten_ID' => $this->input->post('kabupaten'),
|
||||
'Kecamatan_ID' => $this->input->post('kecamatan'),
|
||||
'Desa_ID' => $this->input->post('desa'),
|
||||
|
||||
);
|
||||
|
||||
$insert = $this->db->insert('user', $insert_masteruser);
|
||||
return $insert;
|
||||
}
|
||||
|
||||
function edit($id) {
|
||||
$this->db->where('ID_User', $id);
|
||||
$query = $this->db->get('user');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$update_masteruser = array(
|
||||
'FK_TipeUser' => $this->input->post('tipeuser'),
|
||||
'NamaUser_User' => $this->input->post('namauser'),
|
||||
//'Password_User' => $this->input->post('passworduser'),
|
||||
'NamaLengkap_User' => $this->input->post('namalengkapuser'),
|
||||
'Telepon_User' => $this->input->post('teleponuser'),
|
||||
'Email_User' => $this->input->post('emailuser'),
|
||||
'TanggalLahir_User' => $this->input->post('tanggallahiruser'),
|
||||
'TempatLahir_User' => $this->input->post('tempatlahiruser'),
|
||||
'Alamat_User' => $this->input->post('alamatuser'),
|
||||
'JenisKelamin_User' => $this->input->post('jeniskelaminuser'),
|
||||
'Agama_User' => $this->input->post('agamauser'),
|
||||
'TanggalEdit_User' => date('Y-m-d H:i:s'),
|
||||
'Provinsi_ID' => $this->input->post('provinsi'),
|
||||
'Kabupaten_ID' => $this->input->post('kabupaten'),
|
||||
'Kecamatan_ID' => $this->input->post('kecamatan'),
|
||||
'Desa_ID' => $this->input->post('desa'),
|
||||
);
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('ID_User', $id);
|
||||
$this->db->update('user', $update_masteruser);
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->db->where('ID_User', $id);
|
||||
$query = $this->db->get('user');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('ID_User', $id);
|
||||
$this->db->delete('user');
|
||||
}
|
||||
|
||||
function editfoto() {
|
||||
$config = array(
|
||||
'upload_path' => "./img/",
|
||||
'allowed_types' => "jpg|jpeg",
|
||||
'overwrite' => TRUE,
|
||||
'max_size' => "2048000", // Can be set to particular file size , here it is 2 MB(2048 Kb)
|
||||
'max_height' => "768",
|
||||
'max_width' => "1024"
|
||||
);
|
||||
$this->load->library('upload', $config);
|
||||
$upload_data = $this->upload->data();
|
||||
$file_name = $upload_data['file_name'];
|
||||
|
||||
$update_user = array(
|
||||
'Foto_User' => $file_name,
|
||||
'TanggalEdit_User' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
$id = $this->session->userdata('s_ID_User_suratpnm');
|
||||
$this->db->where('ID_User', $id);
|
||||
$this->db->update('user', $update_user);
|
||||
}
|
||||
|
||||
function resetpass($id) {
|
||||
$update_user = array(
|
||||
'Password_User' => "simkoprasiBMB",
|
||||
'TanggalEdit_User' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
$this->db->where('ID_User', $id);
|
||||
$this->db->update('user', $update_user);
|
||||
}
|
||||
|
||||
function editpass($id) {
|
||||
$update_user = array(
|
||||
'Password_User' => $this->input->post('renewpass'),
|
||||
'TanggalEdit_User' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
$this->db->where('ID_User', $id);
|
||||
$this->db->update('user', $update_user);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
class M_menu extends CI_Model {
|
||||
|
||||
function index() {
|
||||
$this->db->order_by('mm_urutan', 'ASC');
|
||||
$query = $this->db->get('master_menu');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function hakakses($id) {
|
||||
$this->db->where('mum_tipeuser_id', $id);
|
||||
$query = $this->db->get('master_user_menu');
|
||||
return $query->result();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class M_tipeuser extends CI_Model {
|
||||
|
||||
function index() {
|
||||
$query = $this->db->get('master_tipeuser');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$insert_tipeuser = array(
|
||||
'mt_nama' => $this->input->post('namatipeuser'),
|
||||
);
|
||||
$insert = $this->db->insert('master_tipeuser', $insert_tipeuser);
|
||||
}
|
||||
|
||||
function edit($id) {
|
||||
$this->db->where('mt_id', $id);
|
||||
$query = $this->db->get('master_tipeuser');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$update_tipeuser = array(
|
||||
'mt_nama' => $this->input->post('namatipeuser'),
|
||||
);
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('mt_id', $id);
|
||||
$this->db->update('master_tipeuser', $update_tipeuser);
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->db->where('mt_id', $id);
|
||||
$query = $this->db->get('master_tipeuser');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('mt_id', $id);
|
||||
$this->db->delete('master_tipeuser');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
class M_userlogin extends CI_Model {
|
||||
function index() {
|
||||
$this->db->join('master_tipeuser', 'master_tipeuser.mt_id = master_user.mu_tipeuser_id','left');
|
||||
$query = $this->db->get('master_user');
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$insert_userlogin = array(
|
||||
'mu_nama_lengkap' => $this->input->post('namalengkapuser'),
|
||||
'mu_nama_user' => $this->input->post('namauser'),
|
||||
'mu_password' => md5($this->input->post('passworduser')),
|
||||
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
||||
);
|
||||
$insert = $this->db->insert('master_user', $insert_userlogin);
|
||||
}
|
||||
|
||||
function edit($id) {
|
||||
$this->db->where('mu_id', $id);
|
||||
$query = $this->db->get('master_user');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function prosesedit() {
|
||||
$loketdat = $this->input->post('loket');if(empty($loketdat)){$loketdat=null;}
|
||||
$klinik = $this->input->post('klinik');if(empty($klinik)){$klinik=null;}
|
||||
$password = $this->input->post('passworduser');
|
||||
if(empty($password)){
|
||||
$update_userlogin = array(
|
||||
'mu_nama_lengkap' => $this->input->post('namalengkapuser'),
|
||||
'mu_nama_user' => $this->input->post('namauser'),
|
||||
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
||||
);
|
||||
}else{
|
||||
$update_userlogin = array(
|
||||
'mu_nama_lengkap' => $this->input->post('namalengkapuser'),
|
||||
'mu_nama_user' => $this->input->post('namauser'),
|
||||
'mu_password' => md5($this->input->post('passworduser')),
|
||||
'mu_tipeuser_id' => $this->input->post('tipeuser'),
|
||||
);
|
||||
}
|
||||
$id = $this->input->post('id');
|
||||
$this->db->where('mu_id', $id);
|
||||
$this->db->update('master_user', $update_userlogin);
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->db->where('mu_id', $id);
|
||||
$query = $this->db->get('master_user');
|
||||
return $query;
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
$this->db->where('mu_id', $id);
|
||||
$this->db->delete('master_user');
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user