From 008471a19d61b5882daa101ea82eac16b45d4982 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Mon, 3 Mar 2014 17:28:33 +0000 Subject: [PATCH] Automated importing of LoTW users --- application/controllers/update.php | 24 +++++++++++++++++++++++- application/models/lotw.php | 16 ++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 application/models/lotw.php diff --git a/application/controllers/update.php b/application/controllers/update.php index 75425b53..decb6473 100644 --- a/application/controllers/update.php +++ b/application/controllers/update.php @@ -4,7 +4,8 @@ class Update extends CI_Controller { /* Controls Updating Elements of Cloudlog Functions: - dxcc + dxcc - imports the latest clublog cty.xml data + lotw_users - imports lotw users */ public function index() @@ -160,5 +161,26 @@ class Update extends CI_Controller { echo ""; } + + public function lotw_users() { + // Load Database connectors + $this->load->model('lotw'); + + $this->lotw->empty_table("lotw_list"); + + $lines = file('http://www.hb9bza.net/lotw/lotw1.txt'); + + // Loop through our array, show HTML source as HTML source; and line numbers too. + foreach ($lines as $line_num => $line) { + echo "Line #{$line_num} : " . htmlspecialchars($line) . "
\n"; + + $data = array( + 'Callsign' => $line, + ); + + $this->db->insert('lotw_list', $data); + + } + } } ?> \ No newline at end of file diff --git a/application/models/lotw.php b/application/models/lotw.php new file mode 100644 index 00000000..8b74cb30 --- /dev/null +++ b/application/models/lotw.php @@ -0,0 +1,16 @@ +db->empty_table($table); + } +} +?> \ No newline at end of file