Topic: Codeigniter

codeigniter 3 Multiple File Drag and Drop Upload 0

codeigniter 3 Multiple File Drag and Drop Upload using DropzoneJS

Today, We want to share with you codeigniter 3 Multiple File Drag and Drop Upload using DropzoneJS.In this post we will show you File Upload using dropzone.js and Codeigniter, hear for multiple image upload in codeigniter with database demo we will give you demo and example for implement.In this post, we will learn about codeigniter multiple image upload with preview with an example.

codeigniter 3 Multiple File Drag and Drop Upload using DropzoneJS

There are the Following The simple About codeigniter 3 Multiple File Drag and Drop Upload using DropzoneJS Full Information With Example and source code.

As I will cover this Post with live Working example to develop drag and drop in codeigniter, so the codeigniter 3 multiple file upload for this example is following below.

Step 1: Download Latest version of the CodeIgniter,

You need to first of all, simple Download CodeIgniter version and setup Localsystem.and then here create a new folder application root here display index.php file.

Step 2: Download dropzone.js Setup

here all the Codeigniter dropzone all the folders and files download here https://github.com/enyo/dropzone

Step 3: codeigniter Define a Controller

simple create a main logic of the codeigniter controllers for dropzone.

dropzone.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
class Dropzone extends CI_Controller {
  
    public function __construct() {
       parent::__construct();
       $this->load->helper(array('url','html','form')); 
    }
 
    public function index() {
        $this->load->view('multiple_files_view');
    }
    
    public function upload() {
        if (!empty($_FILES)) {
        $tmpfiles = $_FILES['file']['tmp_name'];
        $mflname = $_FILES['file']['name'];
        $targetPath = getcwd() . '/uploads/';
        $destination = $targetPath . $mflname ;
        move_uploaded_file($tmpfiles, $destination);
        }
    }
}
 
/* End of include file your main dropzone.js */
/* Your Location Put your Files: ./application/controllers/dropzone.php */

Step 4: codeigniter View File

Make a simple view file all the html elemets

multiple_files_view.php

<html>
<head>
<title>File Upload using dropzone.js and Codeigniter</title>
<link href="<?php echo base_url(); ?>resouces/css/dropzone.css" type="text/css" rel="stylesheet" />
<script src="<?php echo base_url(); ?>resouces/dropzone.min.js"></script>
</head>
<body>
<h1>PHP Ajax File Upload using dropzone.js and Codeigniter - pakainfo.com</h1>
<form action="<?php echo site_url('/dropzone/upload'); ?>" class="dropzone"  >
</form>
<a href="https://pakainfo.com/" target="_blank" alt="pakainfo" title="pakainfo">Free Download Example - Pakainfo.com</a>
</body>
</html>

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 codeigniter 3 Multiple File Drag and Drop Upload using DropzoneJS.
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.

SSL forcefully Redirect HTTP to HTTPS Using .htaccess File 0

SSL forcefully Redirect HTTP to HTTPS Using .htaccess File

Today, We want to share with you SSL forcefully Redirect HTTP to HTTPS Using .htaccess File.In this post we will show you How to force SSL using the .htaccess file , hear for How to redirect HTTP traffic to HTTPS using an .htaccess file we will give you demo and example for implement.In this post, we will learn about Redirecting HTTP to HTTPS Using .htaccess File: Step by Step with an example.

SSL forcefully Redirect HTTP to HTTPS Using .htaccess File

There are the Following The simple About SSL forcefully Redirect HTTP to HTTPS Using .htaccess File Full Information With Example and source code.

As I will cover this Post with live Working example to develop Force your site to load securely with an .htaccess file, so the some Redirect HTTP to HTTPS automatically for this example is following below.

Step 1: first of all simple Editing your .htaccess in main cPanel goto File Manager

Step 2: Sign In to cPanel

Step 3: and then Go to The Files > your File Manager > and Document main Root for:

Step 4: After that choose the tour domain name We want to get access

Step 5: Now a new open tab or window main file opens, look for the name as a .htaccess file.

Step 6: .htaccess redirect http to https

Redirecting HTTP to HTTPS Using .htaccess File

RewriteEngine on

# force ssl
RewriteCond     %{SERVER_PORT} ^80$
RewriteRule     ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Note: Please get Your .htaccess file and all the Backup your main Data website in case all the something goes wrong.

Redirect All Web Traffic

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.myDomainName.com/$1 [R,L]

Redirect Only a Specific Domain

Simple redirecting a specific main My domain Working on SSL forcefully to use HTTPS

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^myDomainName\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.myDomainName.com/$1 [R,L]

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 SSL forcefully Redirect HTTP to HTTPS Using .htaccess File.
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.

PHP GET Base URL Absolute Path Example 0

PHP GET Base URL Absolute Path Example

Today, We want to share with you PHP GET Base URL Absolute Path Example.In this post we will show you PHP: How to get Main or Base URL?, hear for How to get base url, current url in PHP we will give you demo and example for implement.In this post, we will learn about PHP Get Absolute Path, Document Root, Base URL with an example.

PHP GET Base URL Absolute Path Example

There are the Following The simple About PHP GET Base URL Absolute Path Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop php get base domain url from String, so the some php Way to get base domain url for this example is following below.

PHP: How to get Main or Base URL?

$base_url = getBaseUrl();
echo "<pre>";
echo $base_url;
echo "</pre>";
//Output Like https://pakainfo.com/student-management/

Get Base Path Method

/**
 * Example, I am browsing run this in my domain  pakainfo.com 
 * https://pakainfo.com/student-management/index.php?id=8
 */
function getBaseUrl() 
{
    // output: /student-management/index.php
    $currentPath = $_SERVER['PHP_SELF']; 
    
    // output: Array ( [dirname] => /student-management [basename] => index.php [extension] => php [filename] => index ) 
    $pathInfo = pathinfo($currentPath); 
    
    // output: pakainfo.com
    $hostName = $_SERVER['HTTP_HOST']; 
    
    // output: http://
    $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https://'?'https://':'http://';
    
    // return: https://pakainfo.com/student-management/
    return $protocol.$hostName.$pathInfo['dirname']."/";
}

PHP Get Absolute Path

/var/www/path/pakainfo.com/httpdocs/path/directory
$base_dir = __DIR__;
echo $base_dir;

PHP Get Document Root

php get base domain url Example

/var/www/path/pakainfo.com/httpdocs
$doc_root = preg_replace("!${_SERVER['SCRIPT_NAME']}$!", '', $_SERVER['SCRIPT_FILENAME']);
echo $doc_root;

PHP Get Base URL

BASE_URL and ROOT_PATH

Example of the PHP Get Absolute Path, Document Root, Base URL

//PHP GET base directory
$base_dir = __DIR__;

//PHP GET Your server protocol
$protocol = empty($_SERVER['HTTPS']) ? 'http' : 'https';

//PHP GET domain name
$domain = $_SERVER['SERVER_NAME'];

//PHP GET base url
$base_url = preg_replace("!^${doc_root}!", '', $base_dir);

//PHP GET server port
$port = $_SERVER['SERVER_PORT'];
$disp_port = ($protocol == 'http' && $port == 80 || $protocol == 'https' && $port == 443) ? '' : ":$port";

//PHP GET put em all together to get the complete base URL
$url = "${protocol}://${domain}${disp_port}${base_url}";

echo $url; // = https://pakainfo.com/path/directory

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 PHP GET Base URL Absolute Path Example.
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.

Codeigniter Fullcalendar Example Tutorial From Scratch 0

Codeigniter Fullcalendar Example Tutorial From Scratch

Today, We want to share with you Codeigniter Fullcalendar Example Tutorial From Scratch.In this post we will show you Fullcalendar with PHP and CodeIgniter, hear for How to integrate jQuery Fullcalendar using Codeigniter and MySQL
we will give you demo and example for implement.In this post, we will learn about Fullcalendar with PHP and CodeIgniter – Database Events with an example.

Codeigniter Fullcalendar Example Tutorial From Scratch

There are the Following The simple About Codeigniter Fullcalendar Example Tutorial From Scratch Full Information With Example and source code.

As I will cover this Post with live Working example to develop Fullcalendar Jquery Codeigniter, so the codeigniter calendar multiple events for this example is following below.

Step 1: Codeigniter Generate events Table

events table

codeigniter full calendar tutorial

CREATE TABLE IF NOT EXISTS `events` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `to_events_date` date NOT NULL,
  `from_events_date` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

Step 2: Create Codeigniter database Settings

application/config/database.php

full calendar codeigniter Configuration of the database

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$active_group = 'default';
$query_builder = TRUE; //boolean true or false
$db['default'] = array(
	'dsn'	=> '',
	'hostname' => 'localhost',
	'username' => 'root',
	'password' => 'My_SET_PASS',
	'database' => 'pakainfo',
	'dbdriver' => 'mysqli', // Database type
	'dbprefix' => '',
	'pconnect' => FALSE, //boolean true or false
	'db_debug' => (ENVIRONMENT !== 'production'), //mode
	'cache_on' => FALSE, //boolean true or false
	'cachedir' => '',
	'char_set' => 'utf8',
	'dbcollat' => 'utf8_general_ci',
	'swap_pre' => '',
	'encrypt' => FALSE, //boolean true or false
	'compress' => FALSE, //boolean true or false
	'stricton' => FALSE, //boolean true or false
	'failover' => array(),
	'save_queries' => TRUE //boolean true or false
);

Step 3: Define a Codeigniter Route

application/config/routes.php

fullcalendar events codeigniter Route

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$route['live-calendar'] = "LiveCalcController";

Step 4: Make a Codeigniter Controller:

application/controllers/LiveCalcController.php

codeigniter Controller event calendar example

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
   
class LiveCalcController extends CI_Controller {
   
    public function __construct() {
       parent::__construct();
       $this->load->database();
    }
    
    public function index()
    {
        $allEvents['result'] = $this->db->get("events")->result();
   
        foreach ($allEvents['result'] as $key => $value) {
            $allEvents['allEvents'][$key]['title'] = $value->title;
            $allEvents['allEvents'][$key]['start'] = $value->to_events_date;
            $allEvents['allEvents'][$key]['end'] = $value->from_events_date;
            $allEvents['allEvents'][$key]['backgroundColor'] = "#00a65a";
        }
           
        $this->load->view('live_ci_calender', $allEvents);
    }
}

Step 5: Make a Codeigniter View File

application/views/live_ci_calender.php

<!DOCTYPE html>
<html>
<head>
    <title>Codeigniter Fullcalendar Example Tutorial From Scratch</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" />
	<! -- Include jquery version of the 3.3.1 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
	
	<! -- Include fullCalendar 3.9.0 version of the 3.3.1 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.css" />
	
	<! -- Include moment js version of the 2.22.2 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
	
	<! -- Include fullCalendar jquery version of the 3.9.0 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.min.js"></script>
</head>
<body>
  
<div class="pakainfo container">
    <h1>Codeigniter Fullcalendar example - pakainfo.com</h1>
    <div class="pakainfo row" style="width:60%">
       <div class="pakainfo col-md-12">
           <div id="live-calendar"></div>
       </div>
    </div>
</div>
   
<script type="text/javascript">
   //jquery full calendar codeigniter
    var events = <?php echo json_encode($allEvents) ?>;
    
    var date = new Date()
    var d    = date.getDate(),
        m    = date.getMonth(),
        y    = date.getFullYear()
   // jquery events handaling         
    $('#live-calendar').fullCalendar({
      header    : {
        left  : 'prev,next today',  // filter data
        center: 'title',
        right : 'month,agendaWeek,agendaDay'
      },
      buttonText: {
        today: 'today',  //button Label
        month: 'month',	//button Label
        week : 'week',	//button Label
        day  : 'day'	//button Label
      },
      events    : events
    })
</script>
   
</body>
</html>

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 Codeigniter Fullcalendar Example Tutorial From Scratch.
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.

CodeIgniter 3 PDF Generate Tutorial With Example 0

CodeIgniter 3 PDF Generate Tutorial With Example

Today, We want to share with you CodeIgniter 3 PDF Generate Tutorial With Example.In this post we will show you Generate and Download PDF in Codeigniter using mPDF, hear for Codeigniter 3 – Generate PDF from view using dompdf library with example we will give you demo and example for implement.In this post, we will learn about CodeIgniter 3 Tutorial PDF For Beginners with an example.

CodeIgniter 3 PDF Generate Tutorial With Example

There are the Following The simple About CodeIgniter 3 PDF Generate Tutorial With Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Generate PDF Report from MySQL Database using Codeigniter 3, so the How to Generate and Download PDF in Codeigniter using mPDF for this example is following below.

Step 1 : install CodeIgniter 3 Application

Download and Setup CodeIgniter 3 Project.

Step 2 : Setup mPDF Library in CodeIgniter 3

And then Run below simple composer command on terminal to download main vendor folder to put mPDF library from your CodeIgniter 3 project folder. run this command Into make a new simple folder like name as a “vendor” as well as it will download composer To “mpdf” library into it.

$ composer require mpdf/mpdf

Setp 3 : set CodeIgniter vendor Folder path

application/config/config.php

 $config['composer_autoload'] = 'vendor/autoload.php';

Step 4 : Create a Call mPDF Library in CodeIgniter Controller

CI_Controller

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
 
 //CodeIgniter Controller
class Welcome extends CI_Controller {
    public function index()
    {
        $live_mpdf = new \Mpdf\Mpdf();
        $all_html = $this->load->view('html_to_pdf',[],true); //CodeIgniter view file name
        $live_mpdf->WriteHTML($all_html);
        $live_mpdf->Output(); // simple run and opens in browser
        //$live_mpdf->Output('pakainfo_details.pdf','D'); // it CodeIgniter downloads the file into the main dynamic system, with give your file name
    }
 
}

Step 5 : Create a CodeIgniter View Files

view / html_to_pdf.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Welcome to Pakainfo.com</title>
</head>
<body>
 
<div id="pakainfo container">
    <h1>Welcome to Pakainfo.com!</h1>
	<b>Pakainfo is the most popular Programming & Web Development blog.</b>
    <div id="body">
        <p>Our mission is to provide the best online resources on programming and web development.</p>
 
        <p> We deliver the useful and best tutorials for web professionals — developers, programmers, freelancers and site owners.</p>

        <p>Any visitors of this site are free to browse our tutorials, live demos and download scripts.</p>

        <p>Click here to More Information for Pakainfo.com <a href="https://pakainfo.com/" alt="CodeIgniter 3 PDF Generate Tutorial With Example" title="CodeIgniter 3 PDF Generate Tutorial With Example">Pakainfo.com</a>.</p>
    </div>
 
</div>
 
</body>
</html>

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 CodeIgniter 3 PDF Generate Tutorial With Example.
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.

CodeIgniter Create Custom Helper Example Tutorial 0

CodeIgniter Create Custom Helper Example Tutorial From Scratch

Today, We want to share with you CodeIgniter Create Custom Helper Example Tutorial From Scratch.In this post we will show you codeigniter create object of controller, hear for Creating and Extending CodeIgniter Helpers we will give you demo and example for implement.In this post, we will learn about how to call helper function in codeigniter view with an example.

CodeIgniter Create Custom Helper Example Tutorial From Scratch

There are the Following The simple About CodeIgniter Create Custom Helper Example Tutorial From Scratch Full Information With Example and source code.

As I will cover this Post with live Working example to develop How to create custom helper in CodeIgniter, so the Create custom helper in CodeIgniter for this example is following below.

Make CodeIgniter Custom Helper

application/helpers/custom_helper.php

//custom_helper.php
if (! defined('BASEPATH')) exit('No direct script access allowed');
 
//Check custom helper in CodeIgniter if Exists or not
if (! function_exists('sendmail')) {
    function sendmail()
    {
        // get main CodeIgniter object
        $ci = get_instance();
       
        // Write your PHP/CodeIgniter logic as per Your send email curl or any others requirement
        
    }
}

CodeIgniter use custom helper

CodeIgniterload custom helper methods globally

//application/config.php
/*
| -------------------------------------------------------------------
|  Auto-load Helper Files
|  How to create custom helper in CodeIgniter
| -------------------------------------------------------------------
| Prototype:
|
|    $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('app');

How to load custom helper within the controller:

//CodeIgniter load here custom helper 
$this->load->helper('app');

CodeIgniter use custom helper

And then CodeIgniter loading the helper with any of the above simple call the created any methods We can use the custom helper function in CodeIgniter controller and HTML display views.

// Simple CodeIgniter call the function name Like as
sendmail();

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 CodeIgniter Create Custom Helper Example Tutorial From Scratch.
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.

CodeIgniter Insert Records into MySQL database Example 0

CodeIgniter Insert Records into MySQL database Example

Today, We want to share with you CodeIgniter Insert Records into MySQL database Example.In this post we will show you insert form data into database using CodeIgniter, hear for how to insert data in database using model in CodeIgniter we will give you demo and example for implement.In this post, we will learn about how to insert post data in to database with example code in codeigniter with an example.

CodeIgniter Insert Records into MySQL database Example

There are the Following The simple About CodeIgniter Insert Records into MySQL database Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop php – insert data into database with codeigniter, so CodeIgniter save form data to database for this example is following below.

Step 1 : Import MySQL Table into your database

Create a member table schema

CREATE TABLE `members_tbl` (
  `id` int(10) UNSIGNED NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `member_phone` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `member_cmnt` varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `members_tbl`
  ADD PRIMARY KEY (`id`);
 
ALTER TABLE `members_tbl`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;COMMIT;

Step 2: CodeIgniter View Files

application/views/member_form.php

<div id="container">
    <?php echo form_open($this->uri->uri_string()); ?>
 
        <?php echo form_label('Member First Name :'); ?>
        <?php 
            echo form_input(array(
                'id' => 'memberfname',
                'name' => 'memberfname'
            )); 
        ?>
        <?php echo form_error('memberfname'); ?>
 
        <?php echo form_label('Email :'); ?> 
        <?php
            echo form_input(array(
                'id' => 'email',
                'name' => 'email'
            )); 
        ?>
        <?php echo form_error('email'); ?>
 
        <?php echo form_label('Phone Number. :'); ?> 
        <?php
            echo form_input(array(
                'id' => 'member_phone',
                'name' => 'member_phone'
            )); 
        ?>
        <?php echo form_error('member_phone'); ?>
 
        <?php echo form_label('Comments :'); ?> 
        <?php
            echo form_input(array(
                'id' => 'member_cmnt',
                'name' => 'member_cmnt'
            )); 
        ?>
        <?php echo form_error('address'); ?>
 
        <?php
            echo form_submit(array(
                'id' => 'submit',
                'value' => 'Submit'
            )); 
        ?>
    <?php echo form_close(); ?>
 
</div>

Setp 3 : Create a controllers in CodeIgniter

application/controllers/Member.php

<?php
 
class Member extends CI_Controller {
 
    function __construct() {
        parent::__construct();
        $this->load->model('member_model');
        $this->load->model(array('form','url','html'));
        $this->load->databae();
    }
 
    function index() {
 
        $this->load->library('form_validation');
        $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
        $this->form_validation->set_rules('memberfname', 'Member First Name', 'required|min_length[5]|max_length[15]');
        $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
        $this->form_validation->set_rules('member_phone', 'Phone Number', 'required|regex_match[/^[0-9]{10}$/]');
        $this->form_validation->set_rules('member_cmnt', 'Comments', 'required|min_length[10]|max_length[50]');
 
        if ($this->form_validation->run() == FALSE) {
 
            $this->load->view('member_form');
 
        } else {
 
            $membersdata = array(
                'memberfname' => $this->input->post('memberfname'),
                'email' => $this->input->post('email'),
                'member_phone' => $this->input->post('member_phone'),
                'member_cmnt' => $this->input->post('member_cmnt')
            );

            $this->insert_model->form_insert($membersdata);
            $this->load->view('member_form', $membersdata);
        }
    }
 
}
 
?>

Setp 4 : Create a Model in CodeIgniter

application/models/Member_model.php

<?php
    class Member_model extends CI_Model {
        protected $table;
        function __construct() {
            parent::__construct();
            $this->table = 'members_tbl';
        }
        function form_insert($data){
            $this->db->insert($this->table, $data);
        }
    }

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 CodeIgniter Insert Records into MySQL database Example.
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.

PHP Google Two Factor Authentication With CodeIgniter 3 0

PHP Google Two Factor Authentication With CodeIgniter 3 Example

Today, We want to share with you PHP Google Two Factor Authentication With CodeIgniter 3 Example.In this post we will show you PHP Integrating Two-Factor Authentication with CodeIgniter – google 2 factor authentication new phone, hear for Integrating Google Two-Factor Authentication with CodeIgniter 3 we will give you demo and example for implement.In this post, we will learn about How to Implement Google Two Factor Authentication Login In PHP with CodeIgniter 3 with an example.

PHP Google Two Factor Authentication With CodeIgniter 3 Example

There are the Following The simple About PHP Google Two Factor Authentication With CodeIgniter 3 Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop PHP CodeIgniter 3 Google Two Factor Authentication Example, so the Google 2-Step Verification(enable two factor authentication gmail) for this example is following below.

Enable two factor authentication gmail

google 2 factor authentication new phone

How To Works For 2 factor authentication php

PHP Google Two Factor Authentication With CodeIgniter 3 Example Tutorials

PHP Google Two Factor Authentication With CodeIgniter 3 Example Tutorials

Google Two-factor Authentication Tutorial for Codeigniter in Simple our PHP Based CodeIgniter Application is a very simple and easy process. The Google two-factor authentication with generated uniq key will help We to secure your Authentication Simple our admin main login panel with very high secure particular time based an extra layer of main protection. Even if any hackers or unauthorized persona got Simple our main username as well as storng password they data can not log in unless they main know Simple our uniq key or retrive Simple our smart mobile or phone which has connected to google Authenticator app.

Therefor let’s step by step start. The simple main phased is simple latest version of the downloading your system Integrating Google Two-Factor Authentication with CodeIgniter 3 from GitHub. It is a called all the Authentication third party libs and all the relavents methods included but since it has main mind our main BSD Based license, so We can We use that freely in Simple our main any commercial web or mobile application. We can simple google authenticator codeigniter Download from here.

And now, We download it then simple all the source code simple copy this main file GoogleAuthenticator.php file to Simple our codeigniter web application/libraries stored on folder.and Then this file open that file in any you best used editor like notepad++ and some change its PHP Based codeigniter class name to like as GoogleAuthenticator.

And then we have our CodeIgniter library. Now use it in Simple our login function like this,

function login(){

        $this->load->library('GoogleAuthenticator');
        
		//PHP Google Two Factor Authentication With CodeIgniter 3 Example
        //USER Interface Form validation source codes
        $setting = array(
            array(
                'field' => 'uername',
                'label' => 'user Name',
                'rules' => 'trim|required|xss_clean',
                'errors' => array('required' => 'Please Enter Your Username', 'xss_clean' => 'cant inject malicious uniq code')
            ),
            array(
                'field' => 'password',
                'label' => 'password',
                'rules' => 'trim|required|xss_clean',
                'errors' => array('required' => 'Please Enter Your Password.', 'xss_clean' => 'cant inject malicious uniq code')
            ),
            array(
                'field' => 'token',
                'label' => 'Google Two-factor token',
                'rules' => 'trim|xss_clean|max_length[6]',
                'errors' => array('required' => 'Please Enter Your Two Factor Code.', 'xss_clean' => 'cant inject malicious uniq code')
            ),

        );

        $this->form_validation->set_rules($setting);
        if ($this->form_validation->run() == FALSE) 
        {

             $this->load->view('signinpage');

        }
        else
        {
            // google authenticator codeigniter 2 factor authentication source codes

            $googleAuthObj = new GoogleAuthenticator();
            $authSecretKey = "JDBC6PLIJDKDSPNM2L" ; //$googleAuthObj->createSecret();
            $oneCode = $this->input->post('token');
            
            $token = $googleAuthObj->getCode($authSecretKey);
                    
            $googleAuthResults = $googleAuthObj->verifyCode($authSecretKey, $oneCode, 2); // 2 = 2*30sec clock tolerance
	    if (!$googleAuthResults)
            {
               
                $this->index('Sorry Your GoogleAuthenticator Two-factor token Failed'); // main page index function here simple load signin page view
               
            }
            else
            {    
                // Two-factor Source code if results success and then now We simple steps for Simple our username as well as Simple our password Login Authentication with verification
            } 
        }
}

You can make a google generated a new secure key by your calling below some PHP or CodeIgniter function.

$googleAuthObj->createSecret();

Once We make a simple google key download Google Authenticator from products of the google your play store application and setup install Simple our main unique key.

Important Note :The Google algorithm is time-based. A new unique source code is generated every moments means 30 seconds as well as each simple code is valid for main 90 seconds only. Therefor We must ensure that Simple our mobile or smart phone time based and Simple our server sure time is exactly same otherwise, it source code won’t work.Please Comment below if We stuck or encountered any types of the problem or I am freely free happy to help you.

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 PHP Google Two Factor Authentication With CodeIgniter 3 Example.
I would like to have feedback on my Pakainfo.com blog with details of the 2 factor authentication php.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.