Welcome Guest, Not a member yet? Register   Sign In
[solved]cant set cookies
#1

[eluser]Bianca Migueis[/eluser]
trying to update an existing website to codeigniter but got stuck at the login function... the if statement works since im redirected to the hoome page with the right password and username but for some reason it wont create a cookie... any thoughts... please?

Code:
public function authorize()
    {
        $this->db->where('username', $_POST['username']);
        $this->db->where('password', $_POST['password']);
        $data['query'] = $this->db->get('user');
        
        if ($data['query']->num_rows == 1)
        {
            $username = array(
                  'name'    => 'username',
                  'value'   => $_POST['username'],
                  'expire'  => '',
                );
            $password = array(
                  'name'        => 'password',
                  'value'       => $_POST['password'],
                  'expire'      => '',
                );
            $this->input->set_cookie($username);
            $this->input->set_cookie($password);
            
            redirect('home');
        }
        else
        {
            $this->session->set_flashdata('msg', 'Invalid Username or password.');
            
            redirect('signin');
        }
    }


Messages In This Thread
[solved]cant set cookies - by El Forum - 08-14-2011, 10:39 PM
[solved]cant set cookies - by El Forum - 08-14-2011, 11:09 PM
[solved]cant set cookies - by El Forum - 08-14-2011, 11:12 PM
[solved]cant set cookies - by El Forum - 08-14-2011, 11:21 PM
[solved]cant set cookies - by El Forum - 08-14-2011, 11:26 PM
[solved]cant set cookies - by El Forum - 08-15-2011, 04:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB