• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Required File Not Working properly !

Hi, friends
i have two simple pages admin_check.php and dashboard.php
I'm using the admin check file to protect my admin pages so i put a very simple code in it to know if the user logged in or not then I'm using this file ( admin_check) in other files to do the log in check process but it's not working when i require it in other files

This is admin_check code :

class Admin_check extends CI_Controller {
    function index()
  if (!$this->tank_auth->is_logged_in()) {
  } else {
   $user_id = $this->tank_auth->get_user_id();
   $username = $this->tank_auth->get_username();
            echo"Welcome ". $username ." Your ID is ". $user_id ." .";

and This is The dashboard Code :

class Dashboard extends CI_Controller {
    public function index()
        echo"<h2> Here Are DashBoard !</h2>";

Logically When i go to htttp://localhost/codeigniter/index.php/dashboard

it should redirect me to log in page But it doesn't so I'm Wondering what's Wrong ?:coolsmirk:

You are overriding the index method! And this is not the preferred way to extend a controller. Please read http://ellislab.com/codeigniter/user-gui...aries.html especially the part about Extending Native Libraries. Go try that after reading the userguide and have another go at it.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.