Welcome Guest, Not a member yet? Register   Sign In
redirect and come back of my navigator
#11

[eluser]MrAmine[/eluser]
pfff
still the same problem
#12

[eluser]InsiteFX[/eluser]
It sounds like to me that you are having problems else where in your code!

You are going to have to show us your code so that we can see what is going on!

InsiteFX
#13

[eluser]MrAmine[/eluser]
hi evryone
this is my code
Controller
Code:
Class User extends CI_CONTROLLER{

    function index(){
        $this->load->model('login_model');
        $query = $this->login_model->login();
        if($query){
            $data = array(
                'email' => $this->input->post('email_login'),
                'is_logged_in' => true
            );
            $this->session->set_userdata($data);
            redirect('homepage');
        }else{
            redirect('loginpage');
        }
    }

}
And Model
Code:
Class Login_model extends CI_MODEL{

    function login(){
        $this->db->where('email',$this->input->post('email_login'));
        $this->db->where('password',md5($this->input->post('password_login')));
        $query = $this->db->get('members');
        if($query->num_rows == 1){
            return true;
        }else{
            return false;
        }
    }

}
#14

[eluser]InsiteFX[/eluser]
For one your CI_Controller was all uppercase and you did not add the refresh for the redirect!
Code:
Class User extends CI_Controller{

    function index(){
        $this->load->model('login_model');
        $query = $this->login_model->login();
        if($query){
            $data = array(
                'email' => $this->input->post('email_login'),
                'is_logged_in' => true
            );
            $this->session->set_userdata($data);
            redirect('homepage', 'refresh');
        }else{
            redirect('loginpage', 'refresh');
        }
    }

}

Same thing here with your CI_Model you used all uppercase again!
And you are checking $query->num_rows wrong!
Code:
Class Login_model extends CI_Model{

    function login(){
        $this->db->where('email',$this->input->post('email_login'));
        $this->db->where('password',md5($this->input->post('password_login')));
        $query = $this->db->get('members');
        if($query->num_rows() == 1){
            return true;
        }else{
            return false;
        }
    }

}
Both Controller and Model should be save to disk with all lowercase names!

InsiteFX
#15

[eluser]MrAmine[/eluser]
I delete cookies on my browser and I open a blank page I found a cookie ci_session
pffff I understood nothing
#16

[eluser]InsiteFX[/eluser]
Did you read what I just posted above?

InsiteFX
#17

[eluser]MrAmine[/eluser]
please can u write me login controller & method & view
I tried all night yesterday to resolve the problem,
too much for me
#18

[eluser]osci[/eluser]
-off topic-
lol pfffff
#19

[eluser]MrAmine[/eluser]
thank you so much I wrote your code but still the same problem
#20

[eluser]toopay[/eluser]
@MrAmine
Try this :
1. Go to www.facebook.com (if you've already login, log out first).
2. Fill out username & password, click login.
3. Now you should in 'Home' page. Click 'Back', and i bet you'll be back at login form (even in the actual state, you're already login).

What you expect to hapenned?! I told you, the browser fetch the page from its cache, without interacting with the server at all! Its browser mechanism, which nothing to do with your code AT ALL! You will face the same condition in ANY SITE!




Theme © iAndrew 2016 - Forum software by © MyBB