Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Account extends MY_Controller{
- public function __constructor(){
- parent::__constructor();
- }
- public function login(){
- $this->load->helper(array('form', 'url'));
- $this->load->library('form_validation');
- $this->form_validation->set_rules('email', 'Email', 'required');
- $this->form_validation->set_rules('password', 'Password', 'required');
- $this->load->view('topspace');
- if ($this->form_validation->run() == TRUE)
- {
- $email = $this->input->post('email');
- $password = $this->input->post('password');
- $this->ion_auth->login($email, $password, TRUE);
- $this->load->view('login_success');
- }
- else
- {
- $this->load->view('loginform');
- }
- }
- public function register() {
- $this->load->view('topspace');
- $this->load->helper(array('form', 'url'));
- $this->load->library('form_validation');
- $this->form_validation->set_rules('email', 'Email', 'required');
- $this->form_validation->set_rules('password', 'Password', 'required');
- $this->form_validation->set_rules('firstname', 'First Name', 'required');
- $this->form_validation->set_rules('lastname', 'Last Name', 'required');
- $this->form_validation->set_rules('streetaddress', 'Street Address', 'required');
- $this->form_validation->set_rules('city', 'City', 'required');
- $this->form_validation->set_rules('state', 'State', 'required');
- $this->form_validation->set_rules('zip', 'Zip', 'required');
- if ($this->form_validation->run() == TRUE)
- {
- $username = $this->input->post('email');
- $email = $this->input->post('email');
- $password = $this->input->post('password');
- $confirmpassword = $this->input->post('confirmpassword');
- $firstname = $this->input->post('firstname');
- $lastname = $this->input->post('lastname');
- $streetaddress = $this->input->post('streetaddress');
- $city = $this->input->post('city');
- $state = $this->input->post('state');
- $zip = $this->input->post('zip');
- $additional_data = array(
- 'firstname' => $firstname,
- 'lastname' => $lastname,
- 'streetaddress' => $streetaddress,
- 'city' => $city,
- 'state' => $state,
- 'zip' => $zip,
- );
- $group = array('2');
- if ($password == $confirmpassword) {
- $this->ion_auth->register($username, $password, $email, $additional_data, $group);
- $this->load->view('register_success');
- } else {
- $this->load->view('confirmpasswordfail');
- }
- }
- else
- {
- $this->load->view('register');
- }
- }
- }
Add Comment
Please, Sign In to add comment