V
V
vvmgev2015-09-09 16:59:36
MySQL
vvmgev, 2015-09-09 16:59:36

Why doesn't the session work on the first launch of the site?

on the first launch of the site, the session does not work, but on the second launch everything is fine .. the site works on codeigniter armcars.net enter the site and click on the car picture

public function index()
  {
    $lang = $this->session->userdata('lang') == null?"russia":$this->session->userdata('lang');
    $this->session->set_userdata('lang',$lang);
    $this->lang->load($lang,$lang);
    $this->load->model('main_model');
                $this->load->view('main_view_index');

single
public function single($id)
  {
    $lang = $this->session->userdata('lang');
    $this->lang->load($lang,$lang);
    $this->load->model('main_model');
    $data['query'] = $this->main_model->get($id);
    $this->load->view('single_view');
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kim, 2015-09-11
@kimono

The session mechanism is usually based on cookies. Cookies are set when the site is first opened. With the second one, they are already standing and something can already be done with them at the php level. Perhaps this is the whole problem and you just need to rewrite the logic of work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question