Skip to content

Commit

Permalink
Consolidated session->set_userdata calls to fix 502 errors when behin…
Browse files Browse the repository at this point in the history
…d an Nginx proxy
  • Loading branch information
nsnw committed Mar 18, 2015
1 parent 2d19c07 commit c20dfaf
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions application/controllers/qso.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,20 @@ public function index()
$this->logbook_model->add();

// Store Basic QSO Info for reuse
$this->session->set_userdata('band', $this->input->post('band'));
$this->session->set_userdata('freq', $this->input->post('freq'));
$this->session->set_userdata('mode', $this->input->post('mode'));
$this->session->set_userdata('sat_name', $this->input->post('sat_name'));
$this->session->set_userdata('sat_mode', $this->input->post('sat_mode'));
$this->session->set_userdata('radio', $this->input->post('radio'));
// Put data in an array first, then call set_userdata once.
// This solves the problem of CI dumping out the session
// cookie each time set_userdata is called.
// For more info, see http://bizhole.com/codeigniter-nginx-error-502-bad-gateway/
$qso_data = [
'band' => $this->input->post('band'),
'freq' => $this->input->post('freq'),
'mode' => $this->input->post('mode'),
'sat_name' => $this->input->post('sat_name'),
'sat_mode' => $this->input->post('sat_mode'),
'radio' => $this->input->post('radio')
];

$this->session->set_userdata($qso_data);

// Get last Ten QSOs
$data['query'] = $this->logbook_model->last_ten();
Expand Down Expand Up @@ -103,12 +111,16 @@ public function manual()
$this->logbook_model->create_qso();

// Store Basic QSO Info for reuse
$this->session->set_userdata('band', $this->input->post('band'));
$this->session->set_userdata('freq', $this->input->post('freq'));
$this->session->set_userdata('mode', $this->input->post('mode'));
$this->session->set_userdata('sat_name', $this->input->post('sat_name'));
$this->session->set_userdata('sat_mode', $this->input->post('sat_mode'));
$this->session->set_userdata('radio', $this->input->post('radio'));
$qso_data = [
'band' => $this->input->post('band'),
'freq' => $this->input->post('freq'),
'mode' => $this->input->post('mode'),
'sat_name' => $this->input->post('sat_name'),
'sat_mode' => $this->input->post('sat_mode'),
'radio' => $this->input->post('radio')
];

$this->session->set_userdata($qso_data);

// Get last Ten QSOs
$data['query'] = $this->logbook_model->last_ten();
Expand Down

0 comments on commit c20dfaf

Please sign in to comment.