Guest User

Untitled

a guest
Aug 21st, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. CodeIgniter uses index.php
  2. RewriteEngine On
  3. RewriteCond %{REQUEST_URI} ^/system.*
  4. RewriteRule ^(.*)$ index.php?/$1 [L]
  5. RewriteCond %{REQUEST_FILENAME} !-f
  6. RewriteCond %{REQUEST_FILENAME} !-d
  7. RewriteRule ^(.+)$ index.php?/$1 [L]
  8.  
  9. $config['index_page'] = "";
  10.  
  11. public function index()
  12. {
  13. $this->load->helper(array('form', 'url'));
  14. $this->load->model('Registration_Model');
  15. $this->load->library('form_validation');
  16. $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
  17.  
  18. $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]|callback_username_check|xss_clean');
  19. $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[6]|max_length[12]|matches[passconf]');
  20. $this->form_validation->set_rules('passconf', 'Password Confirmation', 'trim|required');
  21. $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|callback_email_check');
  22.  
  23. if ($this->form_validation->run() == FALSE)
  24. {
  25. $this->load->view('registration');
  26. }
  27. else
  28. {
  29. //input data into database here
  30. $username = strtolower($_POST['username']);
  31. $password = md5($_POST['password']);
  32. $email = strtolower($_POST['email']);
  33.  
  34. $data = array
  35. (
  36. 'username' => $username,
  37. 'password' => $password,
  38. 'email' => $email
  39. );
  40.  
  41. $this->Registration_Model->addUser($data);
  42. $this->load->view('registrationsuccess');
  43. }
  44. }
  45.  
  46. RewriteEngine on
  47.  
  48. RewriteCond $1 !^(index.php|robots.txt|images|css|js|user_guide)
  49. RewriteRule ^(.*)$ /index.php/$1 [L]
Add Comment
Please, Sign In to add comment