CodeIgniter Forums
important question - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: important question (/showthread.php?tid=33688)

important question - El Forum - 09-05-2010

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

function __construct(){
        parent :: controller();    
// check cookie and admin information        
        $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;
                    return false;
// end check

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

i think return false; not working

important question - El Forum - 09-05-2010

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:

important question - El Forum - 09-05-2010

[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