From 4ba1dd682a122a0c3d6d9c367e0d735f5a707eb9 Mon Sep 17 00:00:00 2001 From: phl0 Date: Wed, 4 Dec 2024 10:15:32 +0100 Subject: [PATCH] We should check for wrong creds separately --- application/controllers/Lotw.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 35c16fc86..b1e02da61 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -696,12 +696,16 @@ class Lotw extends CI_Controller { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $content = curl_exec($ch); - if(curl_errno($ch) || str_contains($content,"Username/password incorrect")) { + if(curl_errno($ch)) { $result = "LoTW download failed for user ".$data['user_lotw_name'].": ".curl_strerror(curl_errno($ch))." (".curl_errno($ch).")."; if (curl_errno($ch) == 28) { // break on timeout $result .= "
Timeout reached. Stopping subsequent downloads."; break; } + continue; + } else if(str_contains($content,"Username/password incorrect")) { + $result = "LoTW download failed for user ".$data['user_lotw_name'].": Username/password incorrect"; + continue; } file_put_contents($file, $content); if (file_get_contents($file, false, null, 0, 39) != "ARRL Logbook of the World Status Report") { @@ -785,13 +789,14 @@ class Lotw extends CI_Controller { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); $content = curl_exec($ch); - if(!curl_errno($ch) && !str_contains($content,"Username/password incorrect")){ + if(curl_errno($ch)) { + print "LoTW download failed for user ".$data['user_lotw_name'].": ".curl_strerror(curl_errno($ch))." (".curl_errno($ch).")."; + } else if (str_contains($content,"Username/password incorrect")) { + print "LoTW download failed for user ".$data['user_lotw_name'].": Username/password incorrect"; + } else { file_put_contents($file, $content); - ini_set('memory_limit', '-1'); $this->loadFromFile($file, $station_ids); - } else { - print "LoTW download failed for user ".$data['user_lotw_name'].": ".curl_strerror(curl_errno($ch))." (".curl_errno($ch).")."; } } else { if (!is_writable(dirname($file))) {