Advertisement
Guest User

login_dsn.php

a guest
Oct 31st, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <?php
  2. class Login_dsn extends CI_Controller {
  3.  
  4. public function __construct()
  5. {
  6. parent::__construct();
  7. $this->load->model( 'Login_dsn_model', '', TRUE );
  8. }
  9.  
  10. function login_dsn()
  11. {
  12. //$this->load->model( 'Login_dsn_model', '', TRUE );
  13. }
  14.  
  15. function index()
  16. {
  17. if ($this->session->userdata ( 'login_dsn' ) == TRUE)
  18. {
  19. redirect ( 'home_dsn' );
  20. }
  21. else
  22. {
  23. $this->load->view ( 'login_dsn_view' );
  24. }
  25. }
  26.  
  27. function process_login_dsn()
  28. {
  29. $this->form_validation->set_rules('id_dsn', 'Username Ptg', 'required');
  30. $this->form_validation->set_rules('pass_dsn', 'Password Ptg', 'required');
  31.  
  32. if ($this->form_validation->run() == TRUE)
  33. {
  34. $id_dsn = $this->input->post('id_dsn');
  35. $pass_dsn = $this->input->post('pass_dsn');
  36.  
  37. if ($this->Login_dsn_model->check_id_dsn($id_dsn, $pass_dsn) == TRUE)
  38. {
  39. $data = array('id_dsn' => $id_dsn, 'login_dsn' => TRUE);
  40. $this->session->set_userdata($data);
  41. redirect('home_dsn');
  42. }
  43.  
  44. else
  45. {
  46. $this->session->set_flashdata('message', 'Maaf, username dan atau password Anda salah');
  47. redirect('login_dsn/index');
  48. }
  49. }
  50. else
  51. {
  52. $this->load->view('login_dsn_view');
  53. }
  54. }
  55.  
  56. /**
  57. * Memproses logout
  58. */
  59. function process_logout_dsn()
  60. {
  61. $this->session->sess_destroy();
  62. redirect('login_dsn', 'refresh');
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement