Guest User

Untitled

a guest
Jan 12th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. Codeigniter missing argument 1
  2. <?php
  3. class C_login extends CI_Controller{
  4.  
  5. public function __construct() {
  6. parent::__construct();
  7. $this->load->model('m_login');
  8. }
  9.  
  10. function index()
  11. {
  12. $this->form_validation->set_rules('username','trim|Username','required|exact_length[4]|xss_clean');
  13. $this->form_validation->set_rules('password','trim|Password','required|min_length[4]|max_length[40]|xss_clean|callback_login');
  14.  
  15. if($this->form_validation->run() == false)
  16. {
  17. $this->load->view('login');
  18. }
  19. else
  20. {
  21. echo 'sukses validasi';
  22. }
  23.  
  24. }
  25.  
  26. function login($password)
  27. {
  28. $username = $this->input->post('username');
  29. $password = $this->input->post('password');
  30. $jabatan = $this->input->post('jabatan');
  31.  
  32. $value = $this->m_login->cekpass($username,$password,$jabatan);
  33.  
  34. if($value)
  35. {
  36. return true;
  37. }
  38. else
  39. {
  40. return false;
  41. }
  42.  
  43. }
  44.  
  45.  
  46. }
  47. ?>
  48.  
  49. <?php
  50. class M_login extends CI_Model{
  51.  
  52. public function __construct() {
  53. parent::__construct();
  54. }
  55.  
  56. function login ($username, $password, $jabatan)
  57. {
  58. $this->db->where('username',$username);
  59. $this->db->where('password',$password);
  60. $this->db->where('jabatan',$jabatan);
  61.  
  62. $value = $this->db->get('ms_user');
  63.  
  64. if($value->num_rows()>0)
  65. {
  66. return true;
  67. }
  68. else
  69. {
  70. return false;
  71. }
  72.  
  73.  
  74. }
  75. }?>
Add Comment
Please, Sign In to add comment