From a5561236b18e1df3b90bf2af2ebc5d98812a1a0f Mon Sep 17 00:00:00 2001 From: Jeremy Brown Date: Fri, 13 Nov 2020 10:57:48 -0500 Subject: [PATCH] Add a check when doing QRZ lookups to see if the session is valid, if not, create a new session and try again. --- application/models/Logbook_model.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index c89e2807..aba5184c 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -2191,6 +2191,14 @@ class Logbook_model extends CI_Model { $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'), $use_fullname); + + // if we got nothing, it's probably because our session key is invalid, try again + if (!isset($callbook['callsign'])) + { + $qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password')); + $this->session->set_userdata('qrz_session_key', $qrz_session_key); + $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'), $use_fullname); + } } if ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) {