Skip to content

Instantly share code, notes, and snippets.

@andyhawthorne
Created October 17, 2012 07:32
Show Gist options
  • Select an option

  • Save andyhawthorne/3904230 to your computer and use it in GitHub Desktop.

Select an option

Save andyhawthorne/3904230 to your computer and use it in GitHub Desktop.
HMVC2
<?php
public function index()
{
$user = $this->session->userdata('username');
if(isset($user))
{
redirect('admin/admin_home');
}
$this->form_validation->set_rules('email_address', 'Email Address', 'valid_email|required');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[4]');
if($this->form_validation->run() !== false)
{
$res = $this->admin_model->verify_user(
$this->input->post('email_address'),
$this->input->post('password')
);
if ($res !== false)
{
$this->session->set_userdata('username', $this->input->post('email_address'));
redirect('admin/admin_home');
}
}
$this->load->view('login_view');
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment