Example #1
0
 public function fetch()
 {
     $hRow = sqlite_fetch_array($this->oRes);
     if ($this->sClass && $hRow) {
         return Model::get_instance($this->sClass, $hRow);
     }
     return $hRow;
 }
Example #2
0
 public function fetch()
 {
     $hRow = $this->oRes->getNext();
     if ($this->sClass && $hRow) {
         if (is_object($hRow['_id'])) {
             $hRow['_id'] = $hRow['_id']->__toString();
         }
         $sClass = $this->sClass;
         return Model::get_instance($sClass, $hRow);
     }
     return $hRow;
 }
Example #3
0
 protected function input()
 {
     parent::input();
     if (isset($param['logout'])) {
         $logout = $this->clear_int($param['logout']);
         if ($logout) {
             $this->ob_user->logout();
         }
     }
     $this->ob_user = Model_User::get_instance();
     $this->ob_model = Model::get_instance();
     $this->title = 'Massage Practice | ';
     /// разбан через час
     $time_clean = time() - 3600 * UNBAN;
     $this->ob_user->clear_fail($time_clean);
     //проверяем неудачные попытки
     $ip = $_SERVER['REMOTE_ADDR'];
     $fail = $this->ob_user->get_fails($ip);
     $fail = $fail[0]['counter'];
     if (isset($_POST['auth_submit'])) {
         if ($fail < 3) {
             $login = $this->clear_str($_POST['auth_login']);
             $pass = $this->clear_str($_POST['auth_pass']);
             try {
                 $id = $this->ob_user->check_user($login, $pass);
                 //записываем id
                 $this->user_id = $id;
                 $this->ob_user->set();
                 $this->redirect();
             } catch (AuthException $e) {
                 if (!$fail) {
                     $this->ob_user->first_fail($ip);
                 } else {
                     $this->ob_user->update_fail($ip, $fail);
                 }
             }
         } else {
             try {
                 throw new AuthException('Превышено число неправильных попыток! Повторите через 1 час');
             } catch (AuthException $e) {
                 $e->getMessage();
             }
         }
     }
     if (isset($_COOKIE['NOU'])) {
         $id_update = $this->ob_user->unpackage();
         $this->user_id = $id_update[0];
         $this->i_user = $this->ob_user->get_user($this->user_id);
     }
 }
Example #4
0
 protected function input()
 {
     $this->ob_m = Model::get_instance();
     if (isset($_POST['submit_auth'])) {
         $this->myProfile = $this->ob_m->get_user($_POST['login_auth'], $_POST['pass_auth']);
         if ($_SESSION['auth']['res'] == "Неправильный логин/пароль") {
             ?>
             <script>alert("Неправильный логин или пароль")</script>
             <?php 
         } else {
             setcookie('id_user', $_SESSION['auth']['user'][0]['id_user'], time() * 60 * 60 * 24 * 120);
             $this->ob_m->redirect();
         }
         unset($_SESSION['auth']['res']);
     }
     if (isset($_POST['logout'])) {
         $this->ob_m->out();
     }
 }
Example #5
0
 protected function input()
 {
     $this->title = "Արմ-Շին-Էներգո | ";
     foreach ($this->styles as $style) {
         $this->style[] = SITE_URL . VIEW . $style;
     }
     foreach ($this->scripts as $script) {
         $this->script[] = SITE_URL . VIEW . $script;
     }
     //Model - ի օբեկտների ստացում
     $this->ob_m = Model::get_instance();
     //Բազայից նորությունների դուրս բերում
     $this->news = $this->ob_m->get_news();
     //echo "<pre>";
     //print_r($this->news);
     //echo "</pre>";
     //Բազայից ստատիկ էջերի դուրս բերում
     $this->pages = $this->ob_m->get_pages();
     //echo "<pre>";
     //print_r($this->pages);
     //echo "</pre>";
     //Բազայից կատալոգի տեսակների դուրս բերում
     $this->catalog_type = $this->ob_m->get_catalog_type();
     //echo "<pre>";
     //print_r($this->catalog_type);
     //echo "</pre>";
     //Բազայից կատալոգի բրեմդների դուրս բերում
     $this->catalog_brands = $this->ob_m->get_catalog_brands();
     //echo "<pre>";
     //print_r($this->catalog_brands);
     //echo "</pre>";
     //Բազայից գլխավոր մենյուի դուրս բերում
     $this->header_menu = $this->ob_m->get_header_menu();
     //echo "<pre>";
     //print_r($this->header_menu);
     //echo "</pre>";
 }
Example #6
0
 protected function _gc()
 {
     Model::get_instance()->from($this->sess_table)->delete(array("expiry <" => time()));
     return true;
 }