Advertisement
yusran234

proses_login.php

Oct 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class Proses extends CI_Controller {
  5.  
  6. /**
  7. * Index Page for this controller.
  8. *
  9. * Maps to the following URL
  10. * http://example.com/index.php/welcome
  11. * - or -
  12. * http://example.com/index.php/welcome/index
  13. * - or -
  14. * Since this controller is set as the default controller in
  15. * config/routes.php, it's displayed at http://example.com/
  16. *
  17. * So any other public methods not prefixed with an underscore will
  18. * map to /index.php/welcome/<method_name>
  19. * @see https://codeigniter.com/user_guide/general/urls.html
  20. */
  21. public function proses_login(){
  22. $username= $this->input->post('username');
  23. $password= $this->input->post('password');
  24. $data=array(
  25. 'username'=>$username,
  26. 'password'=>$password);
  27. print_r($data);
  28. $cek = $this->M_db->cek_login($data)->result_object();
  29.  
  30. if ($cek){
  31. foreach ($cek as $v) {
  32. $username=$v->username;
  33. $nama=$v->nama;
  34. }
  35. $data_session= array(
  36. 'username'=>$username,
  37. 'nama'=>$nama,
  38. );
  39. $this->session->set_userdata($data_session);
  40. redirect('admin/dashboard');
  41. }
  42. $this->session->set_flashdata('info','username atau password salah');
  43. redirect('welcome');
  44. }
  45.  
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement