hai sahabat blogger yang paling saya kagumi sejakat raya..
saya kesel tau gak sihh.. masak ni yahh, aku kan uda buat blog, taunya aku rada sok sok-an tekan ntah apa gitu, kirain bakalan cakep tampilannya, yang ada malah tampilannya kosong ..
HUHUHU,,,
mau nangis rasanya, malah udah ngantuk, belum lagi perut nih minta makan mulu.. mana ada yang buka warung jam segini..
oala,,,tuhh karna temen saya kali ya, biasanya saya kalo nge-post pasti ada temen ngoding juga, karna sekarang temen yang biasanya bareng saya ngoding gaada, alias dia tidur dikosannya, jadi saya ngoding sendiri..
hmmm…
ya ya ya,, kesel sihhh..
tapi mau gimana lagi, yang bisa temani aku hanya lagu ‘Dari Mata’ yang dibawakan oleh Jaz dan saya putar lewat spotify.. weleh weleh, komplit bett dahhh ..
makin pagi makin ngaco nihhh ceritanya ,, kita langsung aja to the point oke …
kamu siapkan jari yang anti pegel … haha, jarinya diurut dulu gihhh, biar bisa ngoding, soalnya banyak banget yang harus dibuat..
ya ya ya, namanya juga calon junor web develop.. hahha, mimpi aja mahh kalo gue bisa gitu..tapi gak salah sihh kalo ngarep.. pengen bisa, optimis bisa, ambisius bisa tapi tetap ingat satu , andalkan Dia yang memberimu kekuatan untuk ngoding dengan teliti 🙂
nahhhh, aku mau kasih kodingan dari mana dulu, aku juga binggung..
hahhaa,,
dari controller nihhh yahhh…
buat c_login.php pada application/controller
$this->load->database();
$this->load->library(‘form_validation’);
}
public function index()
{
$this->form_validation->set_rules(‘username’,’Username’);
$this->form_validation->set_rules(‘password’,’Password’,’required’);
//$this->form_validation->set_rules(‘ry_password’,’Password Confirmation’,’required’);
$this->form_validation->set_rules(’email’,’Email’,’required|valid_email’);
if ($this->form_validation->run() == FALSE) {
$this->load->view(‘view_login.php’);
}else{
$this->load->view(‘upload_foto.php’);
}
$this->load->view(‘view_login.php’);
}
public function check(){
$login=$this->m_login->login();
if ($login == TRUE) {
$data = array(
‘login’ =>true,
‘username’ => $login->username,
‘Password’ => $login->password,
’email’ => $login->email
);
$this->session->set_userdata($data);
redirect(‘upload/create’);
}else{
//$this->session->set_flasdata(‘Gagal’, ‘Username, email, dan password salah’);
redirect(‘c_login/index’);
}
}
public function logout(){
$this->session->session_destroy();
redirect(‘c_login’);
}
}
upload.php pada application/controller
}
public function index(){
$this->load->view(‘v_upload’, array(‘error’ => ‘ ‘ ));
}
public function aksi_upload(){
$config[‘upload_path’] = ‘./gambar/’;
$config[‘allowed_types’] = ‘gif|jpg|png’;
$config[‘max_size’] = 10000;
$config[‘max_width’] = 10240;
$config[‘max_height’] = 7680;
$this->load->library(‘upload’, $config);
if ( ! $this->upload->do_upload(‘berkas’)){
$error = array(‘error’ => $this->upload->display_errors());
$this->load->view(‘v_upload’, $error);
}else{
$data = array(‘upload_data’ => $this->upload->data());
$this->load->view(‘v_upload_sukses’, $data);
}
}
public function create(){
//form validation sebelum mengeksekusi QUERY INSERT
$this->form_validation->set_rules(‘username’, ‘Username’, ‘required’);
$this->form_validation->set_rules(‘password’, ‘Password’, ‘required’);
$this->form_validation->set_rules(’email’, ’email’, ‘required|email’);
//$this->form_validation->set_rules(‘userfile’, ‘Product Image’, ‘required’);
if ($this->form_validation->run() == TRUE)
{
//load uploading file library
$config[‘upload_path’] = ‘./uploads/’;
$config[‘allowed_types’] = ‘jpg|png’;
$config[‘max_size’] = ‘300’; //KB
$config[‘max_width’] = ‘2000’; //pixels
$config[‘max_height’] = ‘2000’; //pixels
$this->load->library(‘upload’, $config);
if ( ! $this->upload->do_upload())
{
//file gagal diupload -> kembali ke form tambah
$this->load->view(‘register.php’);
} else {
//file berhasil diupload -> lanjutkan ke query INSERT
// eksekusi query INSERT
$gambar = $this->upload->data();
$data_register = array(
‘username’ => set_value(‘username’),
‘password’ => set_value(‘password’),
’email’ => set_value(’email’),
‘image’ => $gambar[‘file_name’]
);
$this->m_upload->create($data_register);
redirect(‘upload/lihat’);
}
} else {
$this->load->view(‘register.php’);
}
}
}
m_login.php pada application/model
$password = $this->input->post(‘password’);
$email = $this->input->post(’email’);
$query = $this->db->query(” select * from user where username=’$username’ and password=’$password’ and email=’$email'”);
if($query->num_rows() == 1){
return $query->row();
} else {
return “”;
}
}
}
register.php pada application/views
<!doctype html>
Register
Register
//
view_login.html pada application/views
<!–
<!– –>
Login and Registration Form with HTML5 and CSS3
view_login.php pada application/views
<!–
<!– –>
Login and Registration
v_upload pada application/views
Upload Foto
https://drive.google.com/drive/u/0/folders/0B7CSXGa2laXcLUk1a2xUMXJNZjg
Leave a Reply