Today, We want to share with you Complete User Registration system using Codeigniter 3.In this post we will show you User Registration and Login System in CodeIgniter 3, hear for Complete User Registration system using PHP and MySQL database we will give you demo and example for implement.In this post, we will learn about Codeigniter 3 – User Registration and Login Example & Tutorial with an example.
Complete User Registration system using Codeigniter 3
There are the Following The simple About Complete User Registration system using Codeigniter 3 Full Information With Example and source code.
As I will cover this Post with live Working example to develop codeigniter login and access management system, so the registration and login form in php Codeigniter 3 and mysql with validation code free download for this example is following below.
Database table creation
Create Codeigniter Database with Table
-- -- Database: `atmiya25` -- -- -------------------------------------------------------- -- -- Table structure for table `members_mst` -- CREATE TABLE `members_mst` ( `id` int(11) NOT NULL, `name` varchar(250) NOT NULL, `email` varchar(250) NOT NULL, `password` text NOT NULL, `member_key_verification` varchar(250) NOT NULL, `is_email_verified` enum('no','yes') NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Indexes for dumped tables -- -- -- Indexes for table `members_mst` -- ALTER TABLE `members_mst` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `members_mst` -- ALTER TABLE `members_mst` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
Autoload Libraries & Helper
autoload.php
$autoload['libraries'] = array('session','database'); $autoload['helper'] = array('url','form');
Codeigniter Database Connection
application/config/database.php
'', 'hostname' => 'localhost', 'username' => 'jaydeep_gondaliya', 'password' => 'atmiya25@98256', 'database' => 'atmiya25', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => FALSE, 'db_debug' => (ENVIRONMENT !== 'production'), 'cache_on' => FALSE, 'cachedir' => '', 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'encrypt' => FALSE, 'compress' => FALSE, 'stricton' => FALSE, 'failover' => array(), 'save_queries' => TRUE ); ?>
Codeigniter Define Controllers (Signup.php)
session->userdata('id')) { redirect('private_area'); } $this->load->library('form_validation'); $this->load->library('encrypt'); $this->load->model('signup_model'); } function index() { $this->load->view('signup'); } function validation() { $this->form_validation->set_rules('member_name', 'Name', 'required|trim'); $this->form_validation->set_rules('member_email', 'Email Address', 'required|trim|valid_email|is_unique[members_mst.email]'); $this->form_validation->set_rules('member_password', 'Password', 'required'); if($this->form_validation->run()) { $member_key_verification = md5(rand()); $encrypted_password = $this->encrypt->encode($this->input->post('member_password')); $data = array( 'name' => $this->input->post('member_name'), 'email' => $this->input->post('member_email'), 'password' => $encrypted_password, 'member_key_verification' => $member_key_verification ); $id = $this->signup_model->insert($data); if($id > 0) { $subject = "Please Your Member verify email for signin"; $message = "Hi Dear".$this->input->post('member_name')."
This is email verification mail from Codeigniter SignIn Signup Management. For complete Step Vy Step process and signin into Management. First of all you want to verify you email by click this Link link.
Once you click this link member email will be verified and you can signin into Management.
Thanks,
"; $config = array( 'protocol' => 'smtp', 'smtp_host' => 'smtpout.secureserver.net', 'smtp_port' => 80, 'smtp_user' => 'YOUR_USERNAME', 'smtp_pass' => 'YOUR_PASSWORDS', 'mailtype' => 'html', 'charset' => 'iso-8859-1', 'wordwrap' => TRUE ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from('[email protected]'); $this->email->to($this->input->post('member_email')); $this->email->subject($subject); $this->email->message($message); if($this->email->send()) { $this->session->set_flashdata('message', 'Check in member email for email verification mail'); redirect('signup'); } } } else { $this->index(); } } function member_email_verify() { if($this->uri->segment(3)) { $member_key_verification = $this->uri->segment(3); if($this->signup_model->member_email_verify($member_key_verification)) { $data['message'] = 'Member Email has been successfully verified, now you can signin from here
'; } else { $data['message'] = 'Sorry, Invalid Link
'; } $this->load->view('email_verification', $data); } } } ?>
Controllers(SignIn.php)
session->userdata('id')) { redirect('private_area'); } $this->load->library('form_validation'); $this->load->library('encrypt'); $this->load->model('signin_model'); } function index() { $this->load->view('signin'); } function validation() { $this->form_validation->set_rules('member_email', 'Email Address', 'required|trim|valid_email'); $this->form_validation->set_rules('member_password', 'Password', 'required'); if($this->form_validation->run()) { $result = $this->signin_model->can_signin($this->input->post('member_email'), $this->input->post('member_password')); if($result == '') { redirect('private_area'); } else { $this->session->set_flashdata('message',$result); redirect('signin'); } } else { $this->index(); } } } ?>
Controller(Private_area.php)
session->userdata('id')) { redirect('signin'); } } function index() { echo 'Welcome User
'; echo ''; } function logout() { $data = $this->session->all_userdata(); foreach($data as $row => $rows_value) { $this->session->unset_userdata($row); } redirect('signin'); } } ?>
Models(Signup_model.php)
db->insert('members_mst', $data); return $this->db->insert_id(); } function member_email_verify($key) { $this->db->where('member_key_verification', $key); $this->db->where('is_email_verified', 'no'); $query = $this->db->get('members_mst'); if($query->num_rows() > 0) { $data = array( 'is_email_verified' => 'yes' ); $this->db->where('member_key_verification', $key); $this->db->update('members_mst', $data); return true; } else { return false; } } } ?>
Models(SignIn_model.php)
db->where('email', $email); $query = $this->db->get('members_mst'); if($query->num_rows() > 0) { foreach($query->result() as $row) { if($row->is_email_verified == 'yes') { $store_password = $this->encrypt->decode($row->password); if($password == $store_password) { $this->session->set_userdata('id', $row->id); } else { return 'Wrong Member Password'; } } else { return 'First verified member email address'; } } } else { return 'Wrong Member Email Address'; } } } ?>
Views(signup.php)
Complete User Registration and SignIn System in Codeigniter
Codeigniter Views(email_verification.php)
Complete SignIn Signup Management in Codeigniter
Codeigniter Views(signin.php)
Complete User Registration and SignIn System in Codeigniter Free Download Example - Pakainfo.com
Complete User Registration and SignIn System in Codeigniter
SignInsession->flashdata('message')) { echo ''.$this->session->flashdata("message").''; } ?>
Angular 6 CRUD Operations Application Tutorials
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about Complete User Registration system using Codeigniter 3.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.