Guest User

Untitled

a guest
Jun 25th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. application/config/form_validation.php
  2.  
  3. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  4.  
  5. $config = array(
  6. 'signup/index' => array(
  7. array(
  8. 'field' => 'email_address',
  9. 'label' => 'Email Address',
  10. 'rules' => 'trim|required|max_length[255]|valid_email|email_in_use'
  11. ),
  12. array(
  13. 'field' => 'password',
  14. 'label' => 'Password',
  15. 'rules' => 'required|min_length[6]'
  16. ),
  17. array(
  18. 'field' => 'confirm_password',
  19. 'label' => 'Confirm Password',
  20. 'rules' => 'required|matches[password]'
  21. ),
  22. ),
  23. );
  24.  
  25.  
  26.  
  27. application/controllers/signup.php
  28.  
  29. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  30.  
  31. class Signup extends CI_Controller {
  32.  
  33. public function __construct() {
  34. parent::__construct();
  35. }
  36.  
  37. public function index() {
  38.  
  39. if ($this->form_validation->run()) {
  40. $this->user_model->insert(array(
  41. 'email_address' => $this->input->post('email_address'),
  42. 'password' => $this->input->post('password'),
  43. ));
  44.  
  45. redirect('/log-in');
  46. }
  47.  
  48. $this->load->view('header');
  49. $this->load->view('signup/index');
  50. $this->load->view('footer');
  51. }
  52.  
  53. }
  54.  
  55. /* End of file signup.php */
  56. /* Location: ./application/controllers/signup.php */
Add Comment
Please, Sign In to add comment