Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Auth extends CI_Controller {
- public function __construct(){
- parent::__construct();
- $this->load->library('form_validation');
- }
- public function index(){
- $this->load->view('template/auth_header');
- $this->load->view('auth/login');
- $this->load->view('template/auth_footer');
- }
- public function registration(){
- //aturan untuk kolom inputan pada form
- $this->form_validation->set_rules('name', 'Name', 'required|trim');
- $this->form_validation->set_rules('email', 'Email', 'required|trim|valid_email');
- $this->form_validation->set_rules('password1', 'Password', 'required|trim|
- min_length[3]|matches[password2]');
- $this->form_validation->set_rules('password2', 'Password', 'required|trim|matches[password1]');
- //logika untuk mengembalikan tampilan apabila form_validasi nya gagal
- if ($this->form_validation->run() == false ){
- $data['judul'] = 'Halaman Registration';
- $this->load->view('template/auth_header', $data);
- $this->load->view('auth/registration');
- $this->load->view('template/auth_footer');
- } else {
- echo 'data berhasil ditambahkan';
- }
- }
- }
Add Comment
Please, Sign In to add comment