[eluser]dallen33[/eluser]
I'm building a website using dx_auth. In MAMP (Mac), it works flawlessly. dx_auth creates an autologin cookie when the user clicks "remember me". Everything just works.
But when I put it on my remote server (IIS, not Apache), the autologin cookie doesn't get created.
Now I've spent some time going through the dx_auth files to see what the problem could be, but I can't figure it out. Here's what I have:
Step 1
User logs in. If Remember is selected, _create_autologin is called.
Quote:function login($login, $password, $remember = TRUE)
{
if ($remember)
{
// Create auto login if user want to be remembered
$this->_create_autologin($row->id);
}
}
I know 'remember' is being sent by the browser by using LiveHTTP in FireFox:
Quote:username=dallen&password=somepass&remember=1&login=Login
Step 2
Here is the _create_autologin function. Looks okay to me.
Quote:function _create_autologin($user_id)
{
$result = FALSE;
// User wants to be remembered
$user = array(
'key_id' => substr(md5(uniqid(rand().$this->ci->input->cookie($this->ci->config->item('sess_cookie_name')))), 0, 16),
'user_id' => $user_id
);
// Load Models
$this->ci->load->model('dx_auth/user_autologin', 'user_autologin');
// Prune keys
$this->ci->user_autologin->prune_keys($user['user_id']);
if ($this->ci->user_autologin->store_key($user['key_id'], $user['user_id']))
{
// Set Users AutoLogin cookie
$this->_auto_cookie($user);
$result = TRUE;
}
return $result;
}
Step 3
And this step creates the cookie.
Quote: function _auto_cookie($data)
{
// Load Cookie Helper
$this->ci->load->helper('cookie');
$cookie = array(
'name' => $this->ci->config->item('DX_autologin_cookie_name'),
'value' => serialize($data),
'expire' => $this->ci->config->item('DX_autologin_cookie_life')
);
set_cookie($cookie);
}
But the problem is that the cookie doesn't get created. What could be the problem? I really can't figure it out.