⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠


profile picture

Login interface for GC (french html / english explain)


  • profile picture
  • Member

Posted 09 January 2014 - 10:35 AM



For my second post i will give you my login interface that use SESSION auth. It's maybe not the better code you ever seen ^^.

If someone want upgrade the code, post here your updates :).


I'm so sorry but i don't generate a registration page.


ALL MODIFICATIONS ARE IN DOWNLOAD FILES AT THE BOTTOM. i'll not present the global code. Just some important modifications.


Well, to start that tuto you have to generate 2 new views :

  • login.php
  • recover.php

Next, you have to change your default route in : appplication/config/routes.php to redirect in login interface (only if you want a codeigniter admin).

$route['default_controller'] = "admin";

$route['admin/(:any)'] = 'admin/index';
$route['recover'] = 'admin/recover';

here you say at codeigniter to start in admin controller (he will ask you to login before access to home controller).


well, now you have to import the SQL file at your sql database. It will generate a users table with one row :

login : admin@admin

password : admin


if u want change your email address, you could easely with mysql remote. (update compte email ...).


well now you just have to go in your baseurl lie : http://localhost/myfolderapp/

If you have change your default controller to my admin controller, you will enter at login interface.


But know we have to blocked the admin GC access. It's really easy because the login function use $_SESSION.


You have to add that specials line at your home controller (administration GC controller) in the construct magick function :

if (!isset($_SESSION['username']) ) {

in the .zip file, you will have an example with a grocery function to admin users :

    public function __construct(){


        if (!isset($_SESSION['username']) ) {
            $this->template->set('title', 'Tableau de bord');
            $this->template->set('nom', $_SESSION["nom"]);

    public function comptes() {

        $me = $this
            ->where('email_address', $_SESSION['username'])

        $crud = new grocery_CRUD();
        $this->template->set('title', 'Gestion des comptes');

        $crud->field_type('password', 'password');
        $crud->where('id >=',$me->row()->id);


        $output = $crud->render();

        $this->template->load('layouts/admin', 'admin/actu',$output);

i hope that my work will help some gorcery users.


It's maybe not a good practice but it works. I create this admin 4 months ago at my first grocery app. I know that it is not the better solution. That's why if someone want help this topic and somes new GC users, he could post here an other solution.


bb ;)

Polash Mahmud

Polash Mahmud
  • profile picture
  • Member

Posted 07 February 2014 - 07:05 AM

Not working :(  error this massage


please help.