Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6913503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:13:38+00:00 2026-05-27T09:13:38+00:00

I have installed tank auth to save me time creating a authentication script. As

  • 0

I have installed tank auth to save me time creating a authentication script.

As I am using HMVC, tank auth has it’s own module (modules/auth).

How can I protect my other modules (/admin, /members etc) with the login script??

From what I have read I need to do something like:

modules::run('auth/is_logged_in'); 

My auth controller looks like:

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

class Auth extends MX_Controller
{
    function __construct()
    {
        parent::__construct();

        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');
        //$this->load->library('security');
        $this->load->library('tank_auth');
        $this->lang->load('tank_auth');

    }

    function index()
    {
        if ($message = $this->session->flashdata('message')) {
            //$this->load->view('auth/auth/general_message', array('message' => $message));

            $main_content = 'auth/auth/general_message';
            $this->load->view('includes/template', array('message' => $message, 'main_content' =>$main_content));
        } else {
            redirect('auth/login/');
        }
    }

    /**
     * Login user on the site
     *
     * @return void
     */
    function login()
    {
        if ($this->tank_auth->is_logged_in()) {                                 // logged in
            redirect('admin');

        } elseif ($this->tank_auth->is_logged_in(FALSE)) {                      // logged in, not activated
            redirect('auth/send_again/');........

an the controller/module I want to protect with the login script:

<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

    class Admin extends MX_Controller {

        public function __construct(){
            parent::__construct();  



            modules::run('auth/auth/login'); 

        }   

The above does not seem to work? What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:13:38+00:00Added an answer on May 27, 2026 at 9:13 am

    I put this code into my controllers:

    function _remap($method)
    {
        if (method_exists($this, $method) && $this->tank_auth->is_logged_in())
        {
            $this->$method();
        }
        else
        {
            redirect('/auth/login/');
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have installed OpenDataKit (ODK) Aggregate and we are using a MySQL Database. I
I have installed wxWidgets 2.9.3 on Ubuntu 10.10 using ../configure --with-gtk I am using
I have installed rvm (mutiuser option) and ruby using rvm install on my test
I have installed mySQL using sudo apt-get install mySQL-server then i have installed libmysqlclient15-dev
I have installed 1.1.9 Yii framework.Then I made copy paste user module in my
I have installed tomcat 6 and 7 to the port 8080. I am using
I have installed a library that has some functions with the same name as
I have installed mysql Query browser for creating tables/ views/ procedures (In Ubuntu) But
I have installed Apache on my server (I wasn't using Apache) and special characters
I have installed the latest ncurses library which my project is using. Now, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.