예제 #1
0
 public function __RuleChecker($RuleID)
 {
     $this->__LoadModules('/Modules/class.UsersModule.php');
     $Users = new UsersModule();
     $UserID = $Users->Session('UserID');
     if (!$UserID) {
         if (!$this->Config['NotLoginIsAlertMessage']) {
             header('Location: ' . $this->Config['NotAccessURL'] . '&RedirectURL=' . urlencode($_SERVER['REQUEST_URI']));
         } else {
             return false;
         }
     } else {
         if ($RuleID) {
             return $Users->CheckRole($RuleID, $UserID);
         } else {
             return true;
         }
     }
 }
예제 #2
0
파일: xpic.php 프로젝트: baiduXM/agent
    }
    $arrPath = explode('/', $path);
    foreach ($arrPath as $dirname) {
        if ($dirname && $dirname != '.' && $dirname != '..') {
            $newPath .= '/' . $dirname;
            if (!file_exists(DocumentRoot . $newPath) || !is_dir(DocumentRoot . $newPath)) {
                if (!@mkdir(DocumentRoot . $newPath, 0777)) {
                    return false;
                }
            }
        }
    }
    return $newPath;
}
$Users = new UsersModule();
$UserID = $Users->Session('UserID');
$UploadSavePath = '/Data/Uploads';
$PicturesModule = new PicturesModule();
if ($system_config['timezone_set'] && function_exists('date_default_timezone_set')) {
    date_default_timezone_set($system_config['timezone_set']);
}
$CurrentDate = date('Y-m-d', time());
if ($UserID) {
    if (!file_exists(DocumentRoot . $UploadSavePath . '/' . $CurrentDate)) {
        if (!_x_mkdir($UploadSavePath . '/' . $CurrentDate)) {
            $ResultMessage = '创建储存目录失败!';
        }
    }
    if (!$ResultMessage) {
        $CurrentSavePath = $UploadSavePath . '/' . $CurrentDate;
        //upload file.
예제 #3
0
 public function Login()
 {
     /*lusb*/
     if ($this->UserID) {
         header('Location: ?module=AdminCP&action=Frame');
         exit;
     }
     if ($this->_POST) {
         $UserName = strtolower(trim($this->_POST['UserName']));
         $Password = $this->_POST['Password'];
         if (!$UserName || !$Password) {
             JsMessage('您没有填写完整,登陆名和密码都不能不填!');
         }
         $Users = new UsersModule();
         $RedirectURL = trim($this->_POST['RedirectURL']);
         $Result = $Users->Login($UserName, $Password);
         switch ($Result) {
             case -1:
                 $this->__Message('非法登陆名, 请确认您的登陆名是否有误!');
                 break;
             case -2:
                 $this->__Message('非法登陆名或错误密码, 请确认您的登陆名和密码!');
                 break;
             case -3:
                 $this->__Message('您的用户不允许登陆, 若有疑问请与管理员联系!');
                 break;
             default:
                 $Users->Session('UserID', $Result);
                 if ($RedirectURL) {
                     $this->__Message(htmlencode($UserName) . ', 您已经成功登陆!', $RedirectURL, '继续操作');
                 } else {
                     $this->__Message(htmlencode($UserName) . ', 您已经成功登陆!', UrlRewriteSimple('AdminCP', 'Frame'), '继续操作');
                 }
         }
     }
     if ($this->_GET['RedirectURL']) {
         $this->RedirectURL = $this->_GET['RedirectURL'];
     }
 }