Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. class Auth extends CI_Controller
  4. {
  5.     public function __construct()
  6.     {
  7.         parent::__construct();
  8.        
  9.         $this->load->library('session');
  10.         $this->load->helper(array('url', 'form'));
  11.         $this->load->model('auth_mod');
  12.        
  13.         $this->output->enable_profiler(TRUE);
  14.     }
  15.    
  16.     public function index()
  17.     {
  18.         if ($this->input->server('REQUEST_METHOD') == 'POST')
  19.         {
  20.             $action = $this->input->post('action');
  21.            
  22.             if ($action == 'login')
  23.             {
  24.                 $email = $this->input->post('email');
  25.                 $password = $this->input->post('password');
  26.                
  27.                 $this->auth_mod->login($email, $password);
  28.             }
  29.             elseif ($action == 'register')
  30.             {
  31.                 $name = $this->input->post('name');
  32.                 $email = $this->input->post('email');
  33.                 $password = $this->input->post('password');
  34.                 $role = $this->input->post('role');
  35.                
  36.                 $this->auth_mod->create_user($name, $email, $password, $role);
  37.             }
  38.             elseif ($action == 'forgotten_password')
  39.             {
  40.                
  41.             }
  42.         }
  43.        
  44.         $this->load->view('auth_view');
  45.        
  46.        
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement