daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Oct 3rd, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <? class Admin extends Controller {
  2.  
  3.     function Admin()
  4.     {
  5.        
  6.         parent::Controller();
  7.         $this->load->model('users');
  8.         //$this->load->scaffolding('entries');
  9.         $this->load->library('session');
  10.         $this->load->helper('url');
  11.         $this->load->helper('form');
  12.         $this->load->library('email');     
  13.        
  14.     }
  15.    
  16.    
  17.     function index()
  18.     {
  19.         $data['title'] = "Admin";
  20.         $data['heading'] = "Travellers Quest Admin Panel";
  21.         $data['msg']='';       
  22.         $this->load->view('templates/application', $data);
  23.     }
  24.    
  25.    
  26.  
  27.     function home(){
  28.         if($_POST){
  29.         $username = $_POST['user_login'];
  30.         $password = $_POST['user_pass'];
  31.         }
  32.         $sessionId = $this->session->userdata('userid');
  33.         $data['name']=$sessionId;
  34.         //Returns userid is successful, false is unsuccessful
  35.         if($sessionId==""){
  36.         $result=$this->users->Adminlogin($username,$password);
  37.        
  38.        
  39.         if ($result==false) { $data['msg']='fail'; redirect('admin',$data); }
  40.         else
  41.         {  
  42.             $query="select * from admin where admin_id='$result'";//$this->db->get_where('register',array('REGISTER_CD'=>$result));
  43.             $result2=mysql_query($query);
  44.             $row = mysql_fetch_array($result2);
  45.            
  46.             //$status = $row['status'];
  47.             $username = $row['username'];
  48.             $lastlogin = $row['date'];
  49.             //$admin_type = $row['admin_type'];
  50.            
  51.            
  52.                
  53.                 $this->session->set_userdata(array('userid'=>$result));
  54.                 $this->session->set_userdata(array('username'=>$username));
  55.                 $this->session->set_userdata(array('lastlogin'=>$lastlogin));
  56.             $this->load->view('templates/application', $data);
  57.            
  58.         }
  59.         }
  60.         else if($sessionId!=''){
  61.            
  62.             $this->load->view('templates/application', $data);
  63.         }
  64.     }
  65. }
  66. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top