diff --git a/application/controllers/view.php b/application/controllers/view.php index 2823db3..ce9e886 100644 --- a/application/controllers/view.php +++ b/application/controllers/view.php @@ -1,10 +1,17 @@ load->model('viewer'); + $this->viewer->clean_viewers(5 * 60); + } + public function index() { } - + public function specific() { $this->load->model('fileupload'); diff --git a/application/models/viewer.php b/application/models/viewer.php index aa58400..c1c1c18 100644 --- a/application/models/viewer.php +++ b/application/models/viewer.php @@ -23,6 +23,12 @@ class Viewer extends CI_Model { return false; } } + + function clean_viewers($duration) { + $clean_time = time() - $duration; + + $this->db->query("DELETE FROM viewers WHERE timestamp < $clean_time"); + } } ?> \ No newline at end of file