first commit

This commit is contained in:
alazhar
2020-01-02 23:07:40 +07:00
commit 06d138977d
387 changed files with 83476 additions and 0 deletions

View File

@ -0,0 +1,65 @@
<?php
class barang_controller extends CI_Controller{
function __Construct()
{
parent ::__construct();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->load->model('barang_model');
}
function barang()
{
if( $this->session->userdata('isLoggedIn') ) {
$this->load->model('barang_model');
$data['judul'] = 'Tampil barang';
$data['daftar_barang'] = $this->barang_model->get_barang_all();
$this->load->view('HalamanUtama', $data);
} else {
redirect('user_controller/login');
}
}
function add_Barang()
{
$data['judul'] = 'Tambah Barang';
$this->load->view('add_barang',$data);
}
function simpan_barang()
{
$this->barang_model->simpan_barang();
redirect('barang_controller/barang','refresh');
}
function edit($id)
{
$data['judul']='Update Barang';
$data['edit']=$this->barang_model->update_barang($id);
$this->load->view('edit_barang', $data);
}
function simpan_update_barang()
{
$id = $this->input->post('id');
$nama = $this->input->post('nama_barang');
$harga = $this->input->post('harga');
$data['judul'] = 'Update Data Codeigniter';
$this->load->model('user_model');
$data['edit'] = $this->barang_model->simpan_update_barang($id, $nama, $harga);
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Succesfully Updated')
</SCRIPT>");
redirect('barang_controller/barang','refresh');
}
function delete($id)
{
$id = $this->barang_model->delete_barang($id);
redirect('barang_controller/barang');
}
}

View File

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@ -0,0 +1,62 @@
<?php
class User_controller extends CI_Controller{
function __Construct()
{
parent ::__construct();
$this->load->model('user_model');
}
function insert_user()
{
$data['judul'] = 'Insert Data User';
$this->load->view('user', $data);
}
function simpan_user()
{
$this->user_model->simpan_user();
$data['notifikasi'] = 'Data berhasil disimpan';
$data['judul']='Insert Data Berhasil';
}
function login()
{
$data['judul'] = 'Halaman Login';
$this->load->view('login', $data);
}
function validasi()
{
$user = $this->input->post('username');
$pass = $this->input->post('password');
$cek = $this->user_model->login($user,$pass);
//echo $cek;
if ($cek)
{
$session = array(
'username' => $user,
'isLoggedIn' => TRUE
);
$this->session->set_userdata($session);
redirect('barang_controller/barang');
echo $this->session->all_userdata();
}
else {
$this->load->view('login');
//echo 'salah';
}
}
function logout()
{
$array_items = array('username' => '', 'isLoggedin' => false);
$this->session->unset_userdata($array_items);
$this->session->sess_destroy();
//$session_destroy();
$data['judul'] = 'Halaman Login';
$this->load->view('login', $data);
}
}
?>

View File

@ -0,0 +1,35 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');
}
public function login()
{
$data['judul'] = 'Halaman Login';
$this->load->view('login', $data);
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */