diff --git a/application/controllers/Clublog.php b/application/controllers/Clublog.php index 8472b5da..74801237 100644 --- a/application/controllers/Clublog.php +++ b/application/controllers/Clublog.php @@ -107,6 +107,14 @@ class Clublog extends CI_Controller { } else { echo "Error ".$response; log_message('error', 'Clublog upload for '.$station_row->station_callsign.' failed reason '.$response); + + // If Clublog responds with a 403 + if ($info['http_code'] == 403) { + $this->load->model('clublog_model'); + echo "Clublog API access denied for ".$station_row->station_callsign."
"; + log_message('error', 'Clublog API access denied for '.$station_row->station_callsign); + $this->clublog_model->reset_clublog_user_fields($station_row->user_id); + } } // Delete the ADIF file used for clublog diff --git a/application/models/Clublog_model.php b/application/models/Clublog_model.php index 009b5412..8aa157fe 100644 --- a/application/models/Clublog_model.php +++ b/application/models/Clublog_model.php @@ -17,6 +17,17 @@ class Clublog_model extends CI_Model { return $row = $query->row_array(); } + // function to reset clublog fields for the user in the auth table + function reset_clublog_user_fields($user_id) { + $data = array( + 'user_clublog_name' => null, + 'user_clublog_password' => null, + ); + + $this->db->where('user_id', $user_id); + $this->db->update($this->config->item('auth_table'), $data); + } + function mark_qsos_sent($station_id) { $data = array( 'COL_CLUBLOG_QSO_UPLOAD_DATE' => date('Y-m-d'),