Advertisement
Guest User

Untitled

a guest
Apr 17th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2.  
  3. class LoginController extends CI_Controller
  4. {
  5. public function process()
  6. {
  7. $this->load->model("LoginModel");
  8. $this->load->model('AccountModel');
  9. //$this->load->library('javascript');
  10. $username = $this->input->post("username");
  11. $password = $this->input->post("password");
  12.  
  13. if ($this->LoginModel->Login($username, $password))
  14. {
  15. $data["Cuentas"] = $this->AccountModel->getAllAccountInfo();
  16. $this->load->view('admin/index', $data);
  17. }
  18. }
  19. }
  20. ?>
  21.  
  22. <?php
  23.  
  24. class AccountModel extends CI_Model
  25. {
  26. public function getAllAccountInfo()
  27. {
  28. $query = $this->db->query('SELECT cuenta, nombre, buscar, pago, monto, fecha, banco, interes, concepto, cuota, credito, debito FROM accounts');
  29. return $query->result_array();
  30. }
  31.  
  32. public function saveData()
  33. {
  34.  
  35. }
  36. }
  37.  
  38. ?>
  39.  
  40. <?php
  41. class LoginModel extends CI_Model
  42. {
  43. public function Login($user, $pass)
  44. {
  45. $this->db->where('username', $user);
  46. $this->db->where('password', $pass);
  47. $query = $this->db->get('usuarios');
  48. if ($query->num_rows() == 1)
  49. return true;
  50. return false;
  51. }
  52. }
  53. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement