• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
session

#1
I want to block the entire link (controller) by login with the active session, how I proceed: here is my code, the login works, but I access to page without going through the login


Model :


PHP Code:
[color=#c5c8c6][size=small][font=Droid Sans Mono][color=#9872a2]function[/color][color=#c5c8c6] [/color][color=#ce6700]getRows[/color][color=#c5c8c6]([/color][color=#6089b4]$params[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#9872a2]array[/color][color=#c5c8c6]())[/color]
[color=#c5c8c6]{[/color]
[color=#c5c8c6]    [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]db[/color][color=#676867]->[/color][color=#ce6700]select[/color][color=#c5c8c6]([/color][color=#9aa83a]'*'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]    [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]db[/color][color=#676867]->[/color][color=#ce6700]from[/color][color=#c5c8c6]([/color][color=#9aa83a]'employe'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6] [/color]
[color=#c5c8c6]    [/color][color=#9a9b99]//fetch data by conditions[/color]
[color=#c5c8c6]    [/color][color=#9872a2]if[/color][color=#c5c8c6]([/color][color=#9872a2]array_key_exists[/color][color=#c5c8c6]([/color][color=#9aa83a]"conditions"[/color][color=#c5c8c6],[/color][color=#6089b4]$params[/color][color=#c5c8c6]))[/color]
[color=#c5c8c6]    {[/color]
[color=#c5c8c6]        [/color][color=#9872a2]foreach[/color][color=#c5c8c6] ([/color][color=#6089b4]$params[/color][color=#c5c8c6][[/color][color=#9aa83a]'conditions'[/color][color=#c5c8c6]] [/color][color=#676867]as[/color][color=#c5c8c6] [/color][color=#6089b4]$key[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c5c8c6] [/color][color=#6089b4]$value[/color][color=#c5c8c6]) [/color]
[color=#c5c8c6]        {[/color]
[color=#c5c8c6]            [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]db[/color][color=#676867]->[/color][color=#ce6700]where[/color][color=#c5c8c6]([/color][color=#6089b4]$key[/color][color=#c5c8c6],[/color][color=#6089b4]$value[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]        }[/color]
[color=#c5c8c6]    }[/color]
[color=#c5c8c6] [/color]
[color=#c5c8c6]    [/color][color=#9872a2]if[/color][color=#c5c8c6]([/color][color=#9872a2]array_key_exists[/color][color=#c5c8c6]([/color][color=#9aa83a]"id_employe"[/color][color=#c5c8c6],[/color][color=#6089b4]$params[/color][color=#c5c8c6]))[/color]
[color=#c5c8c6]    {[/color]
[color=#c5c8c6]        [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]db[/color][color=#676867]->[/color][color=#ce6700]where[/color][color=#c5c8c6]([/color][color=#9aa83a]'id_employe'[/color][color=#c5c8c6],[/color][color=#6089b4]$params[/color][color=#c5c8c6][[/color][color=#9aa83a]'id_employe'[/color][color=#c5c8c6]]);[/color]
[color=#c5c8c6]        [/color][color=#6089b4]$query[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]db[/color][color=#676867]->[/color][color=#ce6700]get[/color][color=#c5c8c6]();[/color]
[color=#c5c8c6]        [/color][color=#6089b4]$result[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#6089b4]$query[/color][color=#676867]->[/color][color=#ce6700]row_array[/color][color=#c5c8c6]();[/color]
[color=#c5c8c6]    }[/color]
[color=#c5c8c6]    [/color][color=#9872a2]else[/color]
[color=#c5c8c6]    {[/color]
[color=#c5c8c6]         [/color]
[color=#c5c8c6]        [/color][color=#9872a2]if[/color][color=#c5c8c6]([/color][color=#9872a2]array_key_exists[/color][color=#c5c8c6]([/color][color=#9aa83a]"start"[/color][color=#c5c8c6],[/color][color=#6089b4]$params[/color][color=#c5c8c6]) [/color][color=#676867]&&[/color][color=#c5c8c6] [/color][color=#9872a2]array_key_exists[/color][color=#c5c8c6]([/color][color=#9aa83a]"limit"[/color][color=#c5c8c6],[/color][color=#6089b4]$params[/color][color=#c5c8c6]))[/color]
[color=#c5c8c6]        {[/color]
[color=#c5c8c6]            [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]db[/color][color=#676867]->[/color][color=#ce6700]limit[/color][color=#c5c8c6]([/color][color=#6089b4]$params[/color][color=#c5c8c6][[/color][color=#9aa83a]'limit'[/color][color=#c5c8c6]],[/color][color=#6089b4]$params[/color][color=#c5c8c6][[/color][color=#9aa83a]'start'[/color][color=#c5c8c6]]);[/color]
[color=#c5c8c6]        }[/color]
[color=#c5c8c6]        [/color][color=#9872a2]elseif[/color][color=#c5c8c6]([/color][color=#676867]![/color][color=#9872a2]array_key_exists[/color][color=#c5c8c6]([/color][color=#9aa83a]"start"[/color][color=#c5c8c6],[/color][color=#6089b4]$params[/color][color=#c5c8c6]) [/color][color=#676867]&&[/color][color=#c5c8c6] [/color][color=#9872a2]array_key_exists[/color][color=#c5c8c6]([/color][color=#9aa83a]"limit"[/color][color=#c5c8c6],[/color][color=#6089b4]$params[/color][color=#c5c8c6]))[/color]
[color=#c5c8c6]        {[/color]
[color=#c5c8c6]            [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]db[/color][color=#676867]->[/color][color=#ce6700]limit[/color][color=#c5c8c6]([/color][color=#6089b4]$params[/color][color=#c5c8c6][[/color][color=#9aa83a]'limit'[/color][color=#c5c8c6]]);[/color]
[color=#c5c8c6]        }[/color]
[color=#c5c8c6]        [/color][color=#6089b4]$query[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]db[/color][color=#676867]->[/color][color=#ce6700]get[/color][color=#c5c8c6]();[/color]
[color=#c5c8c6]        [/color][color=#9872a2]if[/color][color=#c5c8c6]([/color][color=#9872a2]array_key_exists[/color][color=#c5c8c6]([/color][color=#9aa83a]"returnType"[/color][color=#c5c8c6],[/color][color=#6089b4]$params[/color][color=#c5c8c6]) [/color][color=#676867]&&[/color][color=#c5c8c6] [/color][color=#6089b4]$params[/color][color=#c5c8c6][[/color][color=#9aa83a]'returnType'[/color][color=#c5c8c6]] [/color][color=#676867]==[/color][color=#c5c8c6] [/color][color=#9aa83a]'count'[/color][color=#c5c8c6])[/color]
[color=#c5c8c6]        {[/color]
[color=#c5c8c6]            [/color][color=#6089b4]$result[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#6089b4]$query[/color][color=#676867]->[/color][color=#ce6700]num_rows[/color][color=#c5c8c6]();[/color]
[color=#c5c8c6]        }[/color]
[color=#c5c8c6]        [/color][color=#9872a2]elseif[/color][color=#c5c8c6]([/color][color=#9872a2]array_key_exists[/color][color=#c5c8c6]([/color][color=#9aa83a]"returnType"[/color][color=#c5c8c6],[/color][color=#6089b4]$params[/color][color=#c5c8c6]) [/color][color=#676867]&&[/color][color=#c5c8c6] [/color][color=#6089b4]$params[/color][color=#c5c8c6][[/color][color=#9aa83a]'returnType'[/color][color=#c5c8c6]] [/color][color=#676867]==[/color][color=#c5c8c6] [/color][color=#9aa83a]'single'[/color][color=#c5c8c6])[/color]
[color=#c5c8c6]        {[/color]
[color=#c5c8c6]            [/color][color=#6089b4]$result[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] ([/color][color=#6089b4]$query[/color][color=#676867]->[/color][color=#ce6700]num_rows[/color][color=#c5c8c6]() [/color][color=#676867]>[/color][color=#c5c8c6] [/color][color=#6089b4]0[/color][color=#c5c8c6])[/color][color=#676867]?[/color][color=#6089b4]$query[/color][color=#676867]->[/color][color=#ce6700]row_array[/color][color=#c5c8c6]()[/color][color=#676867]:[/color][color=#408080]FALSE[/color][color=#c5c8c6];[/color]
[color=#c5c8c6]        }[/color]
[color=#c5c8c6]        [/color][color=#9872a2]else[/color]
[color=#c5c8c6]        {[/color]
[color=#c5c8c6]            [/color][color=#6089b4]$result[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] ([/color][color=#6089b4]$query[/color][color=#676867]->[/color][color=#ce6700]num_rows[/color][color=#c5c8c6]() [/color][color=#676867]>[/color][color=#c5c8c6] [/color][color=#6089b4]0[/color][color=#c5c8c6])[/color][color=#676867]?[/color][color=#6089b4]$query[/color][color=#676867]->[/color][color=#ce6700]result_array[/color][color=#c5c8c6]()[/color][color=#676867]:[/color][color=#408080]FALSE[/color][color=#c5c8c6];[/color]
[color=#c5c8c6]        }[/color]
[color=#c5c8c6]    }[/color]
[color=#c5c8c6] [/color]
[color=#c5c8c6]     [/color]
[color=#c5c8c6]    [/color][color=#9872a2]return[/color][color=#c5c8c6] [/color][color=#6089b4]$result[/color][color=#c5c8c6];[/color]
[color=#c5c8c6]}[/color][/font][/size][/color] 

LoginController


Code:
[color=#c5c8c6][font=Droid Sans Mono][color=#c5c8c6][b][size=x-large][color=#c5c8c6][size=small][font=Droid Sans Mono][color=#9a9b99]  */[/color]
[color=#c5c8c6]    [/color][color=#9872a2]public[/color][color=#c5c8c6] [/color][color=#9872a2]function[/color][color=#c5c8c6] [/color][color=#ce6700]login[/color][color=#c5c8c6]()[/color]


[color=#c5c8c6]    {[/color]

[color=#c5c8c6]        [/color]
[color=#c5c8c6]        [/color][color=#6089b4]$data[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#9872a2]array[/color][color=#c5c8c6]();[/color]
[color=#c5c8c6]        [/color][color=#9872a2]if[/color][color=#c5c8c6]([/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]userdata[/color][color=#c5c8c6]([/color][color=#9aa83a]'success_msg'[/color][color=#c5c8c6]))[/color]
[color=#c5c8c6]        {[/color]
[color=#c5c8c6]            [/color][color=#6089b4]$data[/color][color=#c5c8c6][[/color][color=#9aa83a]'success_msg'[/color][color=#c5c8c6]] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]userdata[/color][color=#c5c8c6]([/color][color=#9aa83a]'success_msg'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]            [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]unset_userdata[/color][color=#c5c8c6]([/color][color=#9aa83a]'success_msg'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]        }[/color]
[color=#c5c8c6]        [/color][color=#9872a2]if[/color][color=#c5c8c6]([/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]userdata[/color][color=#c5c8c6]([/color][color=#9aa83a]'error_msg'[/color][color=#c5c8c6]))[/color]
[color=#c5c8c6]        {[/color]
[color=#c5c8c6]            [/color][color=#6089b4]$data[/color][color=#c5c8c6][[/color][color=#9aa83a]'error_msg'[/color][color=#c5c8c6]] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]userdata[/color][color=#c5c8c6]([/color][color=#9aa83a]'error_msg'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]            [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]unset_userdata[/color][color=#c5c8c6]([/color][color=#9aa83a]'error_msg'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]        }[/color]
[color=#c5c8c6]        [/color][color=#9872a2]if[/color][color=#c5c8c6]([/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]'loginSubmit'[/color][color=#c5c8c6]))[/color]
[color=#c5c8c6]        {[/color]
[color=#c5c8c6]            [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]form_validation[/color][color=#676867]->[/color][color=#ce6700]set_rules[/color][color=#c5c8c6]([/color][color=#9aa83a]'email'[/color][color=#c5c8c6], [/color][color=#9aa83a]'Email'[/color][color=#c5c8c6], [/color][color=#9aa83a]'required|valid_email'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]            [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]form_validation[/color][color=#676867]->[/color][color=#ce6700]set_rules[/color][color=#c5c8c6]([/color][color=#9aa83a]'password'[/color][color=#c5c8c6], [/color][color=#9aa83a]'password'[/color][color=#c5c8c6], [/color][color=#9aa83a]'required'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]            [/color][color=#9872a2]if[/color][color=#c5c8c6] ([/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]form_validation[/color][color=#676867]->[/color][color=#ce6700]run[/color][color=#c5c8c6]() [/color][color=#676867]==[/color][color=#c5c8c6] [/color][color=#408080]true[/color][color=#c5c8c6]) [/color]
[color=#c5c8c6]            {[/color]
[color=#c5c8c6]                [/color][color=#6089b4]$con[/color][color=#c5c8c6][[/color][color=#9aa83a]'returnType'[/color][color=#c5c8c6]] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#9aa83a]'single'[/color][color=#c5c8c6];[/color]
[color=#c5c8c6]                [/color][color=#6089b4]$con[/color][color=#c5c8c6][[/color][color=#9aa83a]'conditions'[/color][color=#c5c8c6]] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#9872a2]array[/color][color=#c5c8c6]([/color]
[color=#c5c8c6]                    [/color][color=#9aa83a]'email'[/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]'email'[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]                    [/color][color=#9aa83a]'password'[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c5c8c6] [/color][color=#9872a2]md5[/color][color=#c5c8c6]([/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]'password'[/color][color=#c5c8c6])),[/color]
[color=#c5c8c6]                    [/color][color=#9aa83a]'status'[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c5c8c6] [/color][color=#9aa83a]'1'[/color]
[color=#c5c8c6]                    [/color]
[color=#c5c8c6]                );[/color]
[color=#c5c8c6]                [/color][color=#6089b4]$checkLogin[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]Model_db[/color][color=#676867]->[/color][color=#ce6700]getRows[/color][color=#c5c8c6]([/color][color=#6089b4]$con[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]                [/color][color=#9872a2]if[/color][color=#c5c8c6]([/color][color=#6089b4]$checkLogin[/color][color=#c5c8c6])[/color]
[color=#c5c8c6]                {[/color]
[color=#c5c8c6]                    [/color][color=#9a9b99]//$this->Model_db->is_logged_in();[/color]
[color=#c5c8c6]                    [/color]
[color=#c5c8c6]                      [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]set_userdata[/color][color=#c5c8c6]([/color][color=#9aa83a]'isUserLoggedIn'[/color][color=#c5c8c6],[/color][color=#408080]TRUE[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]                      [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]set_userdata[/color][color=#c5c8c6]([/color][color=#9aa83a]'userId'[/color][color=#c5c8c6],[/color][color=#6089b4]$checkLogin[/color][color=#c5c8c6][[/color][color=#9aa83a]'id_employe'[/color][color=#c5c8c6]]);[/color]
[color=#c5c8c6]                     [/color]
[color=#c5c8c6]                      [/color][color=#9872a2]return[/color][color=#c5c8c6] [/color][color=#ce6700]redirect[/color][color=#c5c8c6]([/color][color=#ce6700]site_url[/color][color=#c5c8c6]([/color][color=#9aa83a]'admin'[/color][color=#c5c8c6]));[/color]
[color=#c5c8c6]                     [/color][color=#9a9b99]//return redirect(site_url('create'),$data);[/color]
[color=#c5c8c6]                }[/color]
[color=#c5c8c6]                [/color][color=#9872a2]else[/color]
[color=#c5c8c6]                {[/color]
[color=#c5c8c6]                    [/color][color=#6089b4]$data[/color][color=#c5c8c6][[/color][color=#9aa83a]'error_msg'[/color][color=#c5c8c6]] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#9aa83a]'Wrong email or password, please try again.'[/color][color=#c5c8c6];[/color]
[color=#c5c8c6]                    [/color][color=#9a9b99]//$this->session->set_flashdata('error', 'Invalid Username or Password'); [/color]
[color=#c5c8c6]                }[/color]
[color=#c5c8c6]            }[/color]
[color=#c5c8c6]        }[/color]
[color=#c5c8c6]        [/color][color=#9a9b99]//load the view[/color]
[color=#c5c8c6]        [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]load[/color][color=#676867]->[/color][color=#ce6700]view[/color][color=#c5c8c6]([/color][color=#9aa83a]'users/login'[/color][color=#c5c8c6],[/color][color=#6089b4]$data[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]    }[/color][/font][/size][/color][/size][/b][/color][/font][/color]



[color=#c5c8c6][font=Droid Sans Mono][color=#c5c8c6][b][size=x-large][color=#c5c8c6][size=small][font=Droid Sans Mono][color=#c5c8c6][color=#c5c8c6][size=small][font=Droid Sans Mono][color=#c5c8c6] [/color][color=#9872a2]public[/color][color=#c5c8c6] [/color][color=#9872a2]function[/color][color=#c5c8c6] [/color][color=#ce6700]logout[/color][color=#c5c8c6]()[/color]
[color=#c5c8c6]    {[/color]
[color=#c5c8c6]        [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]unset_userdata[/color][color=#c5c8c6]([/color][color=#9aa83a]'isUserLoggedIn'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]        [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]unset_userdata[/color][color=#c5c8c6]([/color][color=#9aa83a]'userId'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]        [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]session[/color][color=#676867]->[/color][color=#ce6700]sess_destroy[/color][color=#c5c8c6]();[/color]
[color=#c5c8c6]        [/color][color=#ce6700]redirect[/color][color=#c5c8c6]([/color][color=#9aa83a]'users/login/'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]    }[/color][/font][/size][/color][/color][/font][/size][/color][/size][/b][/color][/font][/color]

[b]AdminController[/b]

[b]
  
[/b]

PHP Code:
[color=#c5c8c6][size=small][font=Droid Sans Mono][color=#c5c8c6][b][color=#c5c8c6][size=x-large][font=Droid Sans Mono][b][color=#c5c8c6][size=small][font=Droid Sans Mono][color=#c5c8c6]      [/color][color=#9872a2]public[/color][color=#c5c8c6] [/color][color=#9872a2]function[/color][color=#c5c8c6] [/color][color=#ce6700]index[/color][color=#c5c8c6]()[/color]
[color=#c5c8c6]        {[/color]
[color=#c5c8c6]               [/color]
[color=#c5c8c6]                        [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]load[/color][color=#676867]->[/color][color=#ce6700]view[/color][color=#c5c8c6]([/color][color=#9aa83a]'admin/dashboard'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]                 [/color]
[color=#c5c8c6]  [/color][color=#c5c8c6]        }[/color][/font][/size][/color][/b][/font][/size][/color][/b][/color][/font][/size][/color] 

[b][b]AgenceController[/b][/b]



PHP Code:
[color=#d08442]<?php[/color]
[color=#9872a2]defined[/color][color=#c5c8c6]([/color][color=#9aa83a]'BASEPATH'[/color][color=#c5c8c6]) [/color][color=#676867]OR[/color][color=#c5c8c6] [/color][color=#9872a2]exit[/color][color=#c5c8c6]([/color][color=#9aa83a]'No direct script access allowed'[/color][color=#c5c8c6]);[/color]

[color=#9872a2]class[/color][color=#c5c8c6] [/color][color=#9b0000]Agence[/color][color=#c5c8c6] [/color][color=#9872a2]extends[/color][color=#c5c8c6] [/color][color=#c7444a]MY_Controller[/color][color=#c5c8c6] {[/color]

[color=#c5c8c6]    [/color][color=#9872a2]public[/color][color=#c5c8c6] [/color][color=#9872a2]function[/color][color=#c5c8c6] [/color][color=#9872a2]__construct[/color][color=#c5c8c6]() {[/color]
[color=#c5c8c6]        [/color][color=#9872a2]parent[/color][color=#676867]::[/color][color=#ce6700]__construct[/color][color=#c5c8c6]();[/color]
[color=#c5c8c6]        [/color]
[color=#c5c8c6]        [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]load[/color][color=#676867]->[/color][color=#ce6700]model[/color][color=#c5c8c6]([/color][color=#9aa83a]"Model_db"[/color][color=#c5c8c6]);  [/color]
[color=#c5c8c6]        [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]load[/color][color=#676867]->[/color][color=#ce6700]library[/color][color=#c5c8c6]([/color][color=#9aa83a]"form_validation"[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]    }[/color]
[color=#c5c8c6]   [/color]
[color=#c5c8c6]    [/color][color=#9872a2]public[/color][color=#c5c8c6] [/color][color=#9872a2]function[/color][color=#c5c8c6] [/color][color=#ce6700]create[/color][color=#c5c8c6]()[/color]
[color=#c5c8c6]    { [/color]
[color=#c5c8c6]     [/color]
[color=#c5c8c6]        [/color][color=#6089b4]$data[/color][color=#c5c8c6][[/color][color=#9aa83a]'fetch_data'[/color][color=#c5c8c6]][/color][color=#676867]=[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]Model_db[/color][color=#676867]->[/color][color=#ce6700]agence_list[/color][color=#c5c8c6]();[/color]
[color=#c5c8c6]        [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]load[/color][color=#676867]->[/color][color=#ce6700]view[/color][color=#c5c8c6]([/color][color=#9aa83a]'admin/liste_agence'[/color][color=#c5c8c6], [/color][color=#6089b4]$data[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]    [/color]
[color=#c5c8c6]      [/color]

[color=#c5c8c6]    }[/color]



[color=#c5c8c6]    [/color][color=#9872a2]public[/color][color=#c5c8c6] [/color][color=#9872a2]function[/color][color=#c5c8c6] [/color][color=#ce6700]agence_add[/color][color=#c5c8c6]()[/color]
[color=#c5c8c6]    [/color]
[color=#c5c8c6]    {[/color]
[color=#c5c8c6]      [/color][color=#6089b4]$data[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#9872a2]array[/color][color=#c5c8c6]([/color]
[color=#c5c8c6]      [/color][color=#9aa83a]"nom_agence"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"nom_agence"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]         [/color][color=#9aa83a]"email"[/color][color=#c5c8c6]  [/color][color=#676867]=>[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"email"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]         [/color][color=#9aa83a]"pays"[/color][color=#c5c8c6]  [/color][color=#676867]=>[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"pays"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]         [/color][color=#9aa83a]"telephone"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"telephone"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]         [/color][color=#9aa83a]"compagnie"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"compagnie"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]         [/color][color=#9aa83a]"numero_enregi"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"numero_enregi"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]         [/color][color=#9aa83a]"description"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"description"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]    );[/color]

[color=#c5c8c6]    [/color][color=#6089b4]$insert[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]Model_db[/color][color=#676867]->[/color][color=#ce6700]add_agence[/color][color=#c5c8c6]([/color][color=#6089b4]$data[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]    [/color][color=#9872a2]echo[/color][color=#c5c8c6] [/color][color=#9872a2]json_encode[/color][color=#c5c8c6]([/color][color=#9872a2]array[/color][color=#c5c8c6]([/color][color=#9aa83a]"status"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c5c8c6] [/color][color=#408080]TRUE[/color][color=#c5c8c6]));[/color]
[color=#c5c8c6]    }[/color]

[color=#c5c8c6]    [/color]
[color=#c5c8c6]    [/color]
[color=#c5c8c6]    [/color][color=#9872a2]public[/color][color=#c5c8c6] [/color][color=#9872a2]function[/color][color=#c5c8c6] [/color][color=#ce6700]ajax_edit[/color][color=#c5c8c6]([/color][color=#6089b4]$id[/color][color=#c5c8c6])[/color]
[color=#c5c8c6]          {[/color]
[color=#c5c8c6]        [/color]
[color=#c5c8c6]          [/color][color=#6089b4]$data[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]Model_db[/color][color=#676867]->[/color][color=#ce6700]get_by_id[/color][color=#c5c8c6]([/color][color=#6089b4]$id[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]          [/color][color=#9872a2]echo[/color][color=#c5c8c6] [/color][color=#9872a2]json_encode[/color][color=#c5c8c6]([/color][color=#6089b4]$data[/color][color=#c5c8c6]);[/color]

[color=#c5c8c6]          }[/color]

[color=#c5c8c6]   [/color]
[color=#c5c8c6]   [/color]
[color=#c5c8c6]  [/color][color=#9872a2]public[/color][color=#c5c8c6] [/color][color=#9872a2]function[/color][color=#c5c8c6] [/color][color=#ce6700]save[/color][color=#c5c8c6]()[/color]
[color=#c5c8c6]     [/color]
[color=#c5c8c6]    {[/color]
[color=#c5c8c6]           [/color][color=#6089b4]$id[/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]'id'[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]           [/color][color=#6089b4]$data[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c5c8c6] [/color][color=#9872a2]array[/color][color=#c5c8c6]([/color]
[color=#c5c8c6]             [/color][color=#9aa83a]"nom_agence"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"nom_agence"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]             [/color][color=#9aa83a]"email"[/color][color=#c5c8c6]  [/color][color=#676867]=>[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"email"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]             [/color][color=#9aa83a]"pays"[/color][color=#c5c8c6]  [/color][color=#676867]=>[/color][color=#c5c8c6] [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"pays"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]             [/color][color=#9aa83a]"telephone"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"telephone"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]             [/color][color=#9aa83a]"compagnie"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"compagnie"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]             [/color][color=#9aa83a]"numero_enregi"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"numero_enregi"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]             [/color][color=#9aa83a]"description"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]input[/color][color=#676867]->[/color][color=#ce6700]post[/color][color=#c5c8c6]([/color][color=#9aa83a]"description"[/color][color=#c5c8c6]),[/color]
[color=#c5c8c6]        );[/color]
[color=#c5c8c6]    [/color]
[color=#c5c8c6]        [/color][color=#9a9b99]//$insert = $this->Model_db->agence_update(array('id' => $this->input->post('id')), $data);[/color]
[color=#c5c8c6]        [/color][color=#6089b4]$insert[/color][color=#c5c8c6] [/color][color=#676867]=[/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]Model_db[/color][color=#676867]->[/color][color=#ce6700]agence_update[/color][color=#c5c8c6]([/color][color=#6089b4]$id[/color][color=#c5c8c6],[/color][color=#6089b4]$data[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]        [/color][color=#9872a2]echo[/color][color=#c5c8c6] [/color][color=#9872a2]json_encode[/color][color=#c5c8c6]([/color][color=#9872a2]array[/color][color=#c5c8c6]([/color][color=#9aa83a]"status"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c5c8c6] [/color][color=#408080]TRUE[/color][color=#c5c8c6]));[/color]
[color=#c5c8c6]         [/color]

[color=#c5c8c6]        [/color]

[color=#c5c8c6]        }    [/color]
[color=#c5c8c6] [/color]
[color=#c5c8c6] [/color]
[color=#c5c8c6]    [/color][color=#9872a2]public[/color][color=#c5c8c6] [/color][color=#9872a2]function[/color][color=#c5c8c6] [/color][color=#ce6700]delete[/color][color=#c5c8c6]([/color][color=#6089b4]$id[/color][color=#c5c8c6])[/color]
[color=#c5c8c6]    {[/color]
[color=#c5c8c6]     [/color][color=#c7444a]$this[/color][color=#676867]->[/color][color=#9872a2]Model_db[/color][color=#676867]->[/color][color=#ce6700]delete[/color][color=#c5c8c6]([/color][color=#6089b4]$id[/color][color=#c5c8c6]);[/color]
[color=#c5c8c6]     [/color][color=#9872a2]echo[/color][color=#c5c8c6] [/color][color=#9872a2]json_encode[/color][color=#c5c8c6]([/color][color=#9872a2]array[/color][color=#c5c8c6]([/color][color=#9aa83a]"status"[/color][color=#c5c8c6] [/color][color=#676867]=>[/color][color=#c5c8c6] [/color][color=#408080]TRUE[/color][color=#c5c8c6]));[/color]
[color=#c5c8c6]    }[/color]

[color=#c5c8c6]   }  [/color] 
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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