Advertisement
Guest User

db_model

a guest
Oct 27th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class Db_model extends CI_Model {
  5. public function getLoginData($usr,$pwd){
  6. $u = ($usr);
  7. $p = md5($pwd);
  8. $cek_login->this->db->get_where('user', array('username' => $u, 'password' => $p));
  9. if($cek_login->num_rows() > 0){
  10. $qad = $cek_login->row();
  11. if($u == $qad->username && $p == $qad->password){
  12. if($qad->status == 'admin') {
  13. header('location:'.base_url().'admin');
  14. } elseif ($qad->status == 'guru') {
  15. header('location:'.base_url().'guru');
  16. } else {
  17. header('location:'.base_url().'user');
  18. }
  19. }
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement