Advertisement
fabi0

Untitled

May 26th, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  * To change this license header, choose License Headers in Project Properties.
  5.  * To change this template file, choose Tools | Templates
  6.  * and open the template in the editor.
  7.  */
  8.  
  9. /**
  10.  * Description of mainController
  11.  *
  12.  * @author fabi0
  13.  */
  14.  
  15. namespace Load;
  16.  
  17. class Controller {
  18.  
  19.     protected function render($path, $data = array()) {
  20.  
  21.         include "Views/" . $path . '.php';
  22.     }
  23.  
  24.     protected function alive($databseInstance, $user_id) {
  25.  
  26.  
  27.         $sql = "UPDATE `users` SET `user_active` = " . time() . " WHERE `users`.`user_id` = :user_id;";
  28.         $param = array(
  29.             ':user_id' => array(
  30.                 'param' => $user_id,
  31.                 'type' => 1
  32.             )
  33.         );
  34.         $databseInstance->query($sql, $param);
  35.     }
  36.  
  37.     public function isLogged($cookieInstance, $configInstance, $sessionInstance) {
  38.  
  39.         if ($cookieInstance->exists($configInstance->session_cookie_name)) {
  40.             return unserialize(base64_decode($sessionInstance->get($cookieInstance->get($configInstance->session_cookie_name))));
  41.         } else {
  42.             return false;
  43.         }
  44.     }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement