diff --git a/application/controllers/Api.php b/application/controllers/Api.php
index 126bdfef..c7592110 100644
--- a/application/controllers/Api.php
+++ b/application/controllers/Api.php
@@ -69,6 +69,20 @@ class API extends CI_Controller {
redirect('api/help');
}
+ function delete($key) {
+ $this->load->model('user_model');
+ if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
+
+
+ $this->load->model('api_model');
+
+ $this->api_model->delete_key($key);
+
+ $this->session->set_flashdata('notice', 'API Key '.$key." has been deleted");
+
+ redirect('api/help');
+ }
+
// Example of authing
function auth($key) {
$this->load->model('api_model');
diff --git a/application/models/Api_model.php b/application/models/Api_model.php
index 08946a21..4c41b8b2 100644
--- a/application/models/Api_model.php
+++ b/application/models/Api_model.php
@@ -20,7 +20,7 @@ class API_Model extends CI_Model {
}
function delete_key($key) {
- $this->db->where('id', $key);
+ $this->db->where('key', $key);
$this->db->delete('api');
}
// Generate API Key
diff --git a/application/views/api/help.php b/application/views/api/help.php
index c49c3604..52a6cbde 100644
--- a/application/views/api/help.php
+++ b/application/views/api/help.php
@@ -2,9 +2,9 @@
session->flashdata('notice')) { ?>
-