Esempio n. 1
0
File: Plugin.php Progetto: h1soft/h
 public static function assets($_class)
 {
     $folder_name = substr(md5(\hmvc\Utils\Crypt::crc32($_class)), 0, 11);
     $path = Application::$rootPath . 'assets/' . $folder_name;
     if (!is_dir($path) && \hmvc\Utils\File::dir_is_writable(Application::$rootPath . 'assets/')) {
         mkdir($path, 0777);
     }
     return $path;
 }
Esempio n. 2
0
File: Auth.php Progetto: h1soft/h
 public function login($username, $password)
 {
     if (empty($username) || empty($password)) {
         return false;
     }
     //check db
     $db = \hmvc\Db\Db::getConnection();
     $password = \hmvc\Utils\Crypt::password($password);
     $user = $db->getOne("admin", "username='******' and password='******'");
     if ($user) {
         $this->setId($user['id']);
         $this->setName($user['username']);
         $db->update('admin', array('last_login' => time(), 'login_ip' => Application::app()->request()->ipAddress()), "id='{$user['id']}'");
         //            $this->session->set('auth.id', $this->getId());
         //            $this->session->set('auth.name', $this->getName());
         return true;
     }
     return false;
 }