Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this is dashboard.php
- <?php
- class Dashboard extends CI_Controller{
- function index()
- {
- $done=$this->session->flashdata('userEmail');
- if(!$done)
- {
- echo "not login";
- $this->load->view('main/login_form');
- }
- else
- {
- echo "welcome to dashboard" ;
- $this->session->keep_flashdata('userEmail');
- }
- echo "<br/>" ;
- }
- }
- ?>
- and this login.php code::
- public function login()
- {
- if(isset($_COOKIE['wathba']))
- {
- $this->session->set_flashdata('userEmail', $this->session->userdata('userEmail'));
- redirect('dashboard');
- }
- $this->form_validation->set_rules('userEmail','email','trim|required|valid_email|callback_check_login');
- $this->form_validation->set_rules('userPassword','password','trim|required|md5');
- if($this->form_validation->run()==TRUE)
- {
- if($this->user_model->Login(array('userEmail'=>$this->input->post('userEmail'),'userPassword'=>$this->input->post('userPassword'))))
- { redirect('main/login');
- }
- else
- {
- $this->session->set_flashdata('userEmail', $this->input->post('userEmail'));
- $check_box=$this->input->post('remember');
- echo $check_box ;
- if ($check_box=="remember me")
- {
- echo " checked" ;
- $value=array('userpassword'=>$this->input->post('userPassword'),'userEmail'=>$this->input->post('userEmail'));
- $value=serialize($value);
- $cookie=array(
- 'name'=>'wathba',
- 'value'=>$value ,
- 'expire'=>'2410000', //in seconds
- );
- $this->input->set_cookie($cookie);
- }
- the problem is that i have cookies stord in my computer , and when login is redirect me automatically to
- dashboard.php and give me the result of
- echo "not login";
- $this->load->view('main/login_form'
- that is false , it must echo "dashboard"
- how can i use instead of this sentence $this->session->set_flashdata('userEmail', $this->session->userdata('userEmail'));
- (how i can use data from cookies ?)
Add Comment
Please, Sign In to add comment