I actually do come with an problem with Codeigniter Database Session.

To really make it short, I'm not going multiple login with similar qualifications(login/password).

The very first verification is created by username/passwod matches within the database.

Here's my code

function index()
{
    // Load Model.
    $this->load->model('membres_model');

    // Check if the user is already logged
    if($this->session->userdata('alias') || $this->session->userdata('logged'))
    {
        //Redirect if he is logged.
        redirect('membres/');
    }
    // If the form has been sent.   
    if($this->input->post('submit'))
    {           
        // Trim data
        $this->form_validation->set_rules('alias','Nom d\'utilisateur','trim|required|xss_clean');
        $this->form_validation->set_rules('motdepasse','Mot de passe','trim|required|xss_clean');

        if($this->form_validation->run())
        {
            // check verification in the model
            if($this->membres_model->verification_connexion($this->input->post('alias'),$this->input->post('motdepasse')))
            {
                // Set userdata variables
                $data = array(
                    'alias'     =>  $this->input->post('alias'),
                    'addr_ip'   =>  $_SERVER['REMOTE_ADDR'],
                    'hote'      =>  gethostbyaddr($_SERVER['REMOTE_ADDR']),
                    'logged'    =>  true
                );

                    /****************************************
                    I Want to verify if the membres is already logged if another one want to use the                        same login/password of the logged on. but I don't know how to verify in the                         ci_sessions
                    *****************************************/

                    // start session
                    $this->session->set_userdata($data);
                    // Redirection sur l'espace membre apres la creation de la session.
                    redirect('membres/');
            }
            else {
                // if return false
                $data['error'] = 'Mauvais identifiants';
                $data['contenu'] = 'connexion/formulaire';
                $this->load->view('includes/template',$data);
            }
        } 
        else {

            $data['contenu'] = 'connexion/formulaire'; // La variable vue pour loader dans le template.
            $this->load->view('includes/template',$data);
        }

    } 
    else {

        $data['contenu'] = 'connexion/formulaire'; // La variable vue pour loader dans le template.
        $this->load->view('includes/template',$data);
    }

}
}

I understand I do need to use session Unserialize. I can not obtain the array but I'm not sure how you can compare the information using the drenched user. Does anyone can assist me to ?

Just add another column (say "user_id") towards the periods table, so that you can check it having a single and straightforward SQL query. unserialize() (you will need it) is usually a really slow function and checking each row within the periods table might become an problem.

But ... here's how CodeIgniter unserializes it's session data:

    protected function _unserialize($data)
    {
            $data = @unserialize(strip_slashes($data));

            if (is_array($data))
            {
                    array_walk_recursive($data, array(&$this, '_unescape_slashes'));
                    return $data;
            }

            return (is_string($data)) ? str_replace('{{slash}}', '\\', $data) : $data;
    }

... and here's one known as because of it:

    protected function _unescape_slashes(&$val, $key)
    {
            if (is_string($val))
            {
                    $val= str_replace('{{slash}}', '\\', $val);
            }
    }

You could've used individuals directly if they weren't protected, but ... will still be most likely better that you simply extend the Session library rather than applying it by yourself.