Exemplo n.º 1
0
 function __construct()
 {
     parent::__construct();
     $this->load->model('charts_model');
     $this->load->model('dates_model');
     $this->load->model('reports_model');
     $this->days = 7;
 }
Exemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     global $_SESSION;
     if ($this->check_session() == true) {
         //populate user data and set class variables to authenticated else normal
         $this->populate_data($_SESSION['id']);
     }
 }
Exemplo n.º 3
0
 /**
  * Constructor of the class
  * @global type $_SESSION The Superglobal session variable
  */
 public function __construct()
 {
     parent::__construct();
     global $_SESSION;
     if ($this->check_session() == true) {
         //populate user data and set class variables to authenticated else normal
         $this->populate_data($_SESSION['id']);
         //Insert this recent activity time in the database
         $this->update_lastlogin();
     }
 }
Exemplo n.º 4
0
 public function __construct()
 {
     parent::__construct();
     $msg = array();
     if (isset($_POST['user'])) {
         $user_p = json_decode($_POST['user']);
     }
     $user = json_decode($this->get_user_in());
     $collation = $user_p->token == $user->token ? true : false;
     if ($collation) {
         $this->user_id = $user->user_id;
         if (!empty($_FILES)) {
             //Нужно еще сделать проверку на тип файлов
             $tempPath = $_FILES['file']['tmp_name'];
             $uploadPath = '../uploads' . DIRECTORY_SEPARATOR . $user->user_id . '_' . $_FILES['file']['name'];
             move_uploaded_file($tempPath, $uploadPath);
             //Запись изображения в базу
             $insert_arr = array('user_id' => $this->user_id, 'path' => "{$uploadPath}");
             $result = $this->mysql_insert('photos', $insert_arr);
             $msg['answer'] = 'Файлы успешно загружены';
             $msg['confirm'] = $collation;
             $msg['record_in_db'] = $result;
             $msg['status'] = 1;
             $msg['msg'] = 'Изображения успешно загружены';
             $msg['photo']['id'] = $this->last_id;
             $msg['photo']['path'] = $uploadPath;
             if (!$result) {
                 $msg['query'] = $this->query;
                 $msg['log'] = $this->log;
             }
             $this->answer = $msg;
         } else {
             $this->answer = array('answer' => 'No files');
         }
     } else {
         $msg['status'] = 0;
         $msg['msg'] = 'Пройдите авторизацию';
         $msg['user_p'] = $user_p->token;
         $msg['user'] = $user->token;
         $this->answer = $msg;
     }
 }