Codeigniter Sample Application


Introduction


       CodeIgniter is the simplest PHP Framework which I have ever tried. There are enough tutorials available. It is simple to understand, if you know PHP surely.
The following is one of the simple application created using CI.

Controller Class:



<?php

Class Logins extends CI_Controller {

    

    public function index()

    {

      $this->load->view('header', array('page'=>'login'));

      $data = array('title' => 'Login');

      $this->load->view('display_login', $data);

    }

    

    function ajax_check_login()

    {

        $this->load->model('user_model');

        $user_id = $this->user_model->ajax_check_login_model();

        if ($user_id)

        {

            $this->create_session($user_id);

            echo 1; // valid

        } else {

            echo -1; //invalid

        }

    }

    

    public function create_session($user_id)

    {

        $this->load->library('session');

        if($this->session) {

            $user_name = $this->user_model->get_user_name($user_id);

            $this->session->set_userdata(array(

                    'user_id' => $user_id,

                    'user_name' => $user_name

            ));

        }

    }

        

    public function home()

    {

        .......

        ....... 

    }

    

    public function signout()

    {       

        .......

        ....... 

    }

    

     public function insert_user()

    {        

        .......

        .......  

     }

    

} 




If you need the full code then Click Here Sanjay Kumar's Github





No comments:

Post a Comment

Technologies

1. Nodejs
  • Express
  • Loopback
  • SailsJs
2. Angular
  • 2
  • 4
  • 5
  • 8
3. JQuery
4. PHP
  • LAMP
  • Codeigniter
  • Lumen
5. Database
  • MySQL
  • PostgreSQL
  • MongoDB
6. Artificial Intelligence
  • IBM Watson API
7. Amazon
  • S3
  • EC2
  • SES
  • ELB
8. REST & SOAP API integrations
9. Push notifications
  • FCM - Android
  • APNS - IOS
10. RETS(Real estate domain) servers
11. Standard Implementations
  • 508
  • LTI