Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter and Invision Power Board
#1

[eluser]Cloak[/eluser]
Hey there.
Has anyone figured out how to integrate Invision Power Board with CodeIgniter? I have been unable to do so in my recent tries. I was wondering if there was a library that someone's written or anything :-)

Thanks
#2

[eluser]WanWizard[/eluser]
What's your definition of "integrate"?

Both IPB and CI support the concept of Hooks, so it should be to difficult to have the two environments interact (depending on your definition of course).
#3

[eluser]Cloak[/eluser]
I'm just looking to integrate user sessions and logins.
#4

[eluser]Mat-Moo[/eluser]
I've not got full intergration, but I do use this
Code:
$user=$this->input->cookie("member_id");        // get user id from cookie
        if ($user<>"")
        {
            $this->db->where("member_id",$user);
            $query=$this->db->get('ibf_members');
            if ($query->num_rows()==1)
            {
                $this->user_id=$user;
                $this->user=$query->row_array();
            }
        }
This allows me to do a basic check to see if the user is logged in. It needs more work, but it might help you start (not very secure etc.)

Edit: Might be an idea to get the session_id cookie as well, and double check the user id against the session data.
#5

[eluser]Mat-Moo[/eluser]
Code:
function load_user()
    // use cookie member id to load user
    {
        $user=$this->input->cookie("member_id");        // get user id from cookie
        if ($user<>"")
        {
            $session=$this->input->cookie("session_id");    // check session data matches
            if ($session<>"")                               // we have session data verify it
            {
                $this->db->select('member_id');
                $this->db->where('id',$session);
                $query=$this->db->get('ibf_sessions');
                if ($query->num_rows()==1)
                {
                    $row=$query->row();
                    if ($row->member_id==$user)
                    {
                        $this->db->where("member_id",$user);
                        $query=$this->db->get('ibf_members');
                        if ($query->num_rows()==1)
                        {
                            $this->user_id=$user;
                            $this->user=$query->row_array();
                        }
                    }
                }
            }
        }
    }
Does work, but you'd have to login via ipb, could probbaly do with tweaking Smile
#6

[eluser]moustafa[/eluser]
thanks




Theme © iAndrew 2016 - Forum software by © MyBB