Example #1
0
 static function loginCheck()
 {
     $uname = wf_gpc('wf_uname', 'p', 'trim');
     $upawd = wf_gpc('wf_upawd', 'p', 'trim');
     $uhash = wf_gpc('wf_uhash', 'p', 'trim');
     if (empty($uhash) || $uhash != $_SESSION['wf_uhash']) {
         $_SESSION = array();
         $_SESSION['wf_error'] = '校验码码非法,请刷新页面后重试';
         wf_redirect('login.php?act=in');
     }
     // 请求API接口
     $json_url = WF_API_URL . '?' . http_build_query(array('key' => WF_API_KEY, 'hostid' => WF_API_HOSTID, 'username' => $uname, 'password' => md5(WF_API_KEY . $upawd)));
     $user_info = file_get_contents($json_url);
     $user_info = json_decode($user_info);
     $_SESSION = array();
     if (1 === $user_info->code) {
         $_SESSION['wf_uauth'] = explode(',', $user_info->data->auth);
         $_SESSION['wf_uroot'] = $user_info->data->root;
         $_SESSION['wf_upath'] = $user_info->data->path;
         $_SESSION['wf_uhost'] = $user_info->data->host;
         $_SESSION['wf_tokey'] = self::getTokey();
         $_SESSION['wf_error'] = '';
         wf_redirect('./');
     } else {
         $_SESSION['wf_error'] = $user_info->message;
         wf_redirect('login.php?act=in');
     }
 }
Example #2
0
 static function loginOut()
 {
     $_SESSION = array();
     unset($_SESSION);
     wf_redirect('login.php?act=in');
     exit;
 }
Example #3
0
<?php

require 'config.php';
//判断是否登录,如果不是通过登录进入则进入登录界面
if (!WF_Auth::isLogin()) {
    wf_redirect('login.php?act=in');
    exit;
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8" />
	<title>附件下载管理系统</title>

	<link rel="stylesheet" href="static/css/style.css" />
	<link rel="stylesheet" href="static/css/toolbar.css" />
	<link rel="shortcut icon" href="favicon.ico" />

	<script type="text/javascript">
		window.nfs   = {
			admin: <?php 
echo WF_Auth::isAdmin() ? 'true' : 'false';
?>
,
			host: '<?php 
echo wf_gpc('wf_uhost', 's');
?>
',
			path: '<?php 
echo wf_gpc('wf_upath', 's');