Welcome Guest, Not a member yet? Register   Sign In
ci_sessions not cooperating!![SOLVED]
#1

[eluser]Ivar89[/eluser]
I have a login script to acces my CMS with the help of ci_sessions
Code:
function login()
        {
                $this->form_validation->set_rules('userName', 'Username', 'trim|required|callback_check_login');
                $this->form_validation->set_rules('userPassword', 'Password', 'trim|required');

                if ($this->form_validation->run())
                {
                    if($user = $this->user_model->Login(array('userName' => $this->input->post('userName'), 'userPassword' => $this->input->post('userPassword'))))
                    {
                        redirect('start/index');
                    }else{
                    redirect('login');
                    }
                }
            $this->load->view('admin/login_form');
        }
This works(as far as I kow)
now to get in my CMS it suppose to take you to: start/index but this does not happen!
I AM using te correct login and password(checkd that) else it would give me errors.
It goes wrong here:
Code:
<?php

class start extends Controller {

    function start()
    {
    
    parent::controller();
        $this->load->model('main_model');
        if(!$this->user_model->Secure(array('userType' => 'user')))
        {
            $this->session->set_flashdata('flashError', 'This is not a admin account');
            redirect('admin');
        }
    
    }
it checks the userType here, and it keeps saying it is NOT an admin type(but it is! it also says so in the userdata(of ci_session table)but in the same table it give the flash error for some reason...
then I checked further and when I visite the lgin page it already makes 8 records in the ci_session table:S and normally that doesn't happen...
Now I use the same one with all my other logins I made and never had this before:S
if anyone knows what it is please help meSmile

thanks
#2

[eluser]Ivar89[/eluser]
I typed this in a hurry, appologies for the typo's
basicly my website inserts 8 records in my ci_session table before I even try to login.
It even adds the flash error(no idea if that suppose to happen).
I never edit this coude or anything so I really have no clue whats going on...:S

PS: it does work local...localhost
#3

[eluser]Aken[/eluser]
The sessions are not sticking between your computer and your website, so CI is assuming it's a new visitor on every page load, and creates a new session.

It's likely a cookie issue. Adjust your config.php file's cookie settings to make sure that the domain, path, etc all match properly.
#4

[eluser]pickupman[/eluser]
I am going to guess you are using Internet Explorer as well, which can cause issues. Like Aken mentioned double check your /application/config/config.php for your cookie settings. I would suggest setting
Code:
$config['sess_match_useragent'] = FALSE;
#5

[eluser]Ivar89[/eluser]
OMG thanks it was the:
Code:
$config['sess_match_useragent']    = FALSE
Why does this cause a problem all of a sudden?
it never did before:S...
#6

[eluser]pickupman[/eluser]
Sometimes it just the behavior of IE. Because of compatibility mode, IE may send different user agents to the server.




Theme © iAndrew 2016 - Forum software by © MyBB