Check Username is provided and valid before allowing clublog uploading

pull/302/head
Peter Goodhall 2019-06-19 15:00:16 +01:00
rodzic b26e9e4bdb
commit 94daa81b2c
3 zmienionych plików z 32 dodań i 13 usunięć

Wyświetl plik

@ -12,11 +12,23 @@ class Clublog extends CI_Controller {
}
// Upload ADIF to Clublog
public function upload() {
public function upload($username) {
$this->load->helper('file');
$this->load->model('logbook_model');
$this->load->model('clublog_model');
$clublog_info = $this->clublog_model->get_clublog_auth_info($username);
if(!isset($clublog_info['user_name'])) {
echo "Username unknown";
exit;
}
print_r($clublog_info);
$data['qsos'] = $this->logbook_model->get_clublog_qsos();
// Create ADIF File of contacts not uploaded to Clublog

Wyświetl plik

@ -1,11 +0,0 @@
<?php
class Clublog extends CI_Model {
function __construct()
{
parent::__construct();
}
}
?>

Wyświetl plik

@ -0,0 +1,18 @@
<?php
class Clublog_model extends CI_Model {
function __construct()
{
parent::__construct();
}
function get_clublog_auth_info($username) {
$this->db->select('user_name, user_clublog_name, user_clublog_password, user_clublog_callsign');
$this->db->where('user_name', $username);
$query = $this->db->get($this->config->item('auth_table'));
return $row = $query->row_array();
}
}
?>