Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class Access extends CI_Controller {
- public function index()
- {
- // admin homepage session check
- if($this->session->userdata(username))
- {
- $this->load->view('suparminview/suparminhomepage');
- }
- else
- {
- //if session not created it will be redirect
- redirect('suparmin');
- }
- }
- public function login()
- {
- // login page
- $this->load->view('suparminview/loginpage');
- }
- public function check_login()
- {
- $this->load->library('session');
- $username = $this->input->post('username');
- $password = $this->input->post('password');
- $submit = $this->input->post('submit');
- if(!empty($username) && !empty($password) && isset($submit))
- {
- $pass = (md5($password));
- $this->db->where('uname',$username );
- $this->db->where('pword', $pass);
- $query = $this->db->get('secure');
- if($query->num_rows == 1)
- {
- $this->session->set_userdata($username);
- redirect('suparmin/access');
- }
- else
- {
- header('location:/weblog/suparmin');
- }
- }
- else
- {
- header('location:/weblog/suparmin');
- }
- }
Add Comment
Please, Sign In to add comment