Welcome Guest, Not a member yet? Register   Sign In
important question
#1

[eluser]Mostafa Hassan[/eluser]
i do check in construct function

Code:
function __construct(){
        
        parent :: controller();    
// check cookie and admin information        
        $this->load->database();
        $this->db->where('id','1');
        $query_admin = $this->db->get('admin_info');
        foreach ($query_admin -> result_array() as $admin_info){
            
            if (isset($_COOKIE['admin_name']) && isset($_COOKIE['admin_password']) && $_COOKIE['admin_name'] == $admin_info['admin_name'] && $_COOKIE['admin_password'] == $admin_info['admin_password']){
            return true;
            }else{
                    $this->load->view('admin/admin_login');
                    return false;
            }  
        }
// end check
    }

but it still execute other functions
i want to stop executing the other functions

i think return false; not working
#2

[eluser]slowgary[/eluser]
A class constructor runs upon initializing an object, so if this constructor is in your controller, it'll run every time any of your functions are called, as each function call maps to a page load and each time you visit one of those pages you'll be initializing this controller object.

It's tough to tell what you're trying to do looking at your code, but creating a _remap() frunction in your controller might help your cause: http://ellislab.com/codeigniter/user-gui...#remapping
#3

[eluser]Mostafa Hassan[/eluser]
thank you very much slowgary, i solved the problem by separate the login in new controller. so as i can insert cookie by this controller...

Thank you again Smile




Theme © iAndrew 2016 - Forum software by © MyBB