Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php defined('BASEPATH') or exit('No direct script access allowed');
- class Download extends Web_controller
- {
- public function __construct()
- {
- parent::__construct();
- $this->load->model('web/Download_model');
- }
- public function index()
- {
- $this->vars['download'] = $this->Download_model->CheckDownload()->result_array();
- $this->render_view('download', $this->vars);
- }
- public function dl($id)
- {
- $cek = $this->Download_model->checkFile($id)->result_array();
- $jml = $cek[0]['hit']+1;
- $update = [
- 'hit' => $jml
- ];
- if ($this->Download_model->update($id, $update)) {
- $this->load->helper('download');
- $data = file_get_contents("/content/file/");
- $name = $cek[0]['name'];
- if (force_download($name, $data)) {
- redirect('download', 'refresh');
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement