kopia lustrzana https://github.com/magicbug/Cloudlog
[API] Corrected variable name and check
rodzic
563554dae5
commit
33a81154b6
|
@ -440,7 +440,7 @@ class API extends CI_Controller {
|
|||
|
||||
$userid = $this->api_model->key_userid($obj['key']);
|
||||
|
||||
if(!isset($obj['station_profile_id']) || $this->stations->check_station_against_user($obj['station_profile_id'], $userid) == 0) {
|
||||
if(!isset($obj['station_profile_id']) || $this->stations->check_station_against_user($obj['station_profile_id'], $userid) == false) {
|
||||
http_response_code(401);
|
||||
echo json_encode(['status' => 'failed', 'reason' => "station id does not belong to the API key owner."]);
|
||||
die();
|
||||
|
|
|
@ -427,7 +427,7 @@ class Stations extends CI_Model {
|
|||
public function check_station_against_user($stationid, $userid) {
|
||||
$this->db->select('station_id');
|
||||
$this->db->where('user_id', $userid);
|
||||
$this->db->where('station_id', $id);
|
||||
$this->db->where('station_id', $stationid);
|
||||
$query = $this->db->get('station_profile');
|
||||
if ($query->num_rows() == 1) {
|
||||
return true;
|
||||
|
|
Ładowanie…
Reference in New Issue