Пример #1
0
 public function Auth()
 {
     $user = isset($_POST['login']) ? $_POST['login'] : "";
     $pass = isset($_POST['password']) ? $_POST['password'] : "";
     if (!filters::CharsAndDigits($user) or !authModel::tryLogin($user, $pass)) {
         System::$Scope['loginError'] = true;
         return System::Invoke("main");
     }
     header("Location: /");
 }
Пример #2
0
 public function mainAction()
 {
     if (authModel::is_Authorized()) {
         // go to main page in admin
         header("Location: " . $this->makeURI(array("controller" => "archive")));
     } else {
         // go to authorize form
         header("Location: " . $this->makeURI(array("controller" => "auth")));
     }
     exit;
 }
Пример #3
0
 function __construct()
 {
     // clear messages and errors
     classModel::$errors = classModel::$messages = array();
     // set logout link
     authModel::$logoutLink = $this->makeURI(array("controller" => "auth", "action" => "logout"));
     // check logining
     if (!authModel::is_Authorized()) {
         header("Location: " . $this->makeURI(array("controller" => "auth")));
     } else {
         authModel::$userData = classModel::getSession("userData");
     }
     // create top menu
     self::createTopMenu();
 }
Пример #4
0
 private function Authorize($login, $password)
 {
     if (authModel::checkInBase($login, $password)) {
         classModel::setSession(array('login' => true));
         // set loggined user data
         authModel::$userData = usersModel::getUser("login_user = '******' AND " . "password_user = '******'");
         // write to session
         classModel::setSession(array('userData' => authModel::$userData));
         // go to main admin page
         header("Location: " . $this->makeURI(array('controller' => 'archive')));
         exit;
     } else {
         authModel::$errors[] = 'Wrong login\\password';
     }
     return null;
 }
Пример #5
0
 public function getHttpCodeAction()
 {
     $resources = array();
     $id_application = $_GET['id_application'];
     $id_platform = $_GET['id_platform'];
     if (check_RequestMethod('GET')) {
         set_Json_header();
         $app_data = appsModel::getApplicationData($id_application);
         $platform_data = platformModel::getPlatformData($id_platform);
         /*  bool   CURLOPT_FRESH_CONNECT - TRUE to force the use of a new connection instead of a cached one.
          *  string CURLOPT_USERAGENT     - The contents of the "User-Agent: " header to be used in a HTTP request.
          *  array  CURLOPT_HTTPHEADER     - An array of HTTP header fields to set, in the format array('Content-type: text/plain', 'Content-length: 100')
          *  bool   CURLOPT_RETURNTRANSFER - TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
          * */
         $response_data = apiModel::getRequestInfo($app_data['url_application'], array(CURLOPT_FRESH_CONNECT => true, CURLOPT_USERAGENT => $platform_data['UA_string'], CURLOPT_RETURNTRANSFER => true, CURLINFO_HEADER_OUT => true));
         print_r($response_data);
         $resources = $this->getResources($app_data['url_application'], $response_data['html']);
         if (is_array($resources)) {
             foreach ($resources as $v) {
                 $r = apiModel::getRequestInfo($v, array(CURLOPT_FRESH_CONNECT => true, CURLOPT_USERAGENT => $platform_data['UA_string'], CURLOPT_RETURNTRANSFER => true, CURLINFO_HEADER_OUT => true));
                 $response_data['size_download'] += $r['size_download'];
             }
         }
         $last_log_data = logModel::getLastLogs($id_application, $id_platform);
         $log_data = array('id_application' => $id_application, 'id_platform' => $id_platform, 'HTTP_code' => !count(apiModel::$errors) ? $response_data['http_code'] : apiModel::$errors[0], 'date_check' => date('Y-m-d H:i:s', time()), 'id_user' => authModel::getCurrentUserId(), 'size_download' => $response_data['size_download'], 'download_content_length' => $response_data['download_content_length'], 'redirect_url' => $response_data['redirect_url'], 'request_header' => $response_data['request_header'], 'weight_diff' => $response_data['size_download'] - $last_log_data[$id_application][$id_platform]['size_download'], 'app_resources' => implode(', ', $resources));
         if (($id_check_log = logModel::checkInBase($log_data, array('date_check', 'app_resources'))) !== false) {
             logModel::updateData($log_data + array('id_check_log' => $id_check_log));
         } else {
             $id_check_log = logModel::insertData($log_data);
         }
         $log_data = logModel::getLog($id_check_log);
         print json_encode($log_data + array('curl_response' => $response_data, 'last_log' => $last_log_data));
         die;
     } else {
         _404();
     }
 }
Пример #6
0
 /**
  * 配置用户组权限
  */
 public function configPermission()
 {
     $db = M('node');
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $action = 'insert';
         if ($db->table('access')->count($_GET['rid'])) {
             $action = 'update';
         }
         $_POST['permissions'] = json_encode($_POST['permissions']);
         $db->table('access')->{$action}();
         $this->success('权限修改成功。', 'roleList');
     }
     $authModel = new authModel();
     $permissions = $authModel->get_permissions(array($_GET['rid']));
     $nodes = $db->order('sort,nid')->findall();
     $nodes = formatLevelData2($nodes, array('nid', 'pid'));
     $this->assign('nodes', $nodes);
     $this->assign('permissions', $permissions);
     $this->display();
 }
Пример #7
0
 private function getFilter()
 {
     if (authModel::is_SuperUserSession()) {
         $id_user = classModel::getCurrentUserId();
         // if the superuser is logged - set id user according to the filter state
         classModel::setSession('id_user', $id_user);
         return $this->render('filter_section', array('user_filter' => userModel::getUsers(), 'curent_user' => $id_user));
     } else {
         return null;
     }
 }
Пример #8
0
<?php

require "models/concentreseModel.php";
require "models/authModel.php";
session_start();
if (empty($_GET['url'])) {
    $url = "Home";
} elseif ($_GET['url'] == "out") {
    session_destroy();
    header('Location: http://localhost/project/index.php');
} else {
    $url = $_GET['url'];
}
$obj = new concentreseModel();
if (isset($_SESSION['tabla'])) {
    $obj->mostrar($url);
} else {
    if (isset($_POST['correo'])) {
        $obj->iniciar();
        $_SESSION['pareja'] = "0000000000000000000";
        $_SESSION['simple'] = 0;
        $obj->mostrar($url);
    } else {
        $login = new authModel();
        $login->login();
    }
}