Exemple #1
0
function Check(&$login, &$c_passwd)
{
    global $db, $msg;
    try {
        $db = GetDBConnect();
    } catch (Exception $e) {
        $msg = $e->getMessage();
        return false;
    }
    if ($row = $db->Query_Fetch_Assoc("SELECT id, password FROM users " . "WHERE login='******' AND is_deleted=0 LIMIT 0,1")) {
        if (isset($_SESSION[S_ID . "_challenge"]["random"]) && md5($_SESSION[S_ID . "_challenge"]["random"] . $row["password"]) == $c_passwd) {
            session_destroy();
            return $row["id"];
        }
    }
    return false;
}
Exemple #2
0
 function __construct($module_name, $menu_t_name)
 {
     $this->timestart = microtime(true);
     // формируем глобальный _GET
     if (isset($_SERVER["REDIRECT_QUERY_STRING"])) {
         $query_arr = explode("&", $_SERVER["REDIRECT_QUERY_STRING"]);
         foreach ($query_arr as $nv) {
             $nv_arr = explode("=", $nv);
             $_GET[$nv_arr[0]] = $nv_arr[1];
         }
     }
     $this->db = GetDBConnect();
     $this->sys_user = new System_User($this->db);
     $this->sys_user->Current();
     $this->sys_user->UpdateLocation();
     if (!($row = $this->db->Query_Fetch_Assoc("SELECT menus.id as menu_id " . "FROM modules LEFT JOIN menus ON modules.id=menus.module_id " . "LEFT JOIN groups_menus ON menus.id=groups_menus.menu_id " . "WHERE modules.name='" . $module_name . "' AND menus.translit_name='" . $menu_t_name . "' " . "AND (" . $this->sys_user->groups_SQL . ") " . "LIMIT 0,1"))) {
         throw new class404("нет элемента меню " . $menu_t_name . " для модуля - " . $module_name);
     }
     $menu_id =& $row["menu_id"];
     $this->menu = new Menu($this->db, $this->sys_user, $menu_id);
     $this->module =& $this->menu->module;
     $this->template = new Template($this->sys_user, $this->menu);
     $this->goback = new goback_refrr();
     // переменные окружения!
     include "global.php";
     $db = $this->db;
     $sys_user = $this->sys_user;
     $path = "/" . $this->module->path;
     $inc_path = $this->module->path;
     $url_path = $module_name . "/" . $menu_t_name;
     // определение типа отображаемого скрипта
     if (ereg("xml\$", $this->menu->script)) {
         $this->type = 2;
         return;
     }
     if (ereg("^http:\\/\\/", $this->module->path) || ereg("htm[l]?\$", $this->menu->script) || ereg("^http:\\/\\/", $this->menu->script)) {
         $this->type = 1;
         return;
     }
     $this->type = 0;
 }
Exemple #3
0
 *   (см. "Стандартную публичную лицензию GNU").
 *
 *   Вместе с данной программой вы должны были получить копию "Стандартной
 *   публичной лицензии GNU"; если это не так, напишите в Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *  
 *   Copyright (C) 2008 by Gleb Y. Averchuk <*****@*****.**> 
 *   Vedro System - Web CMS с удобными компонентами для работы с БД.
 */
require_once "config.php";
require_once "classes/db_mysql.php";
require_once "classes/system_user.php";
require_once "include/session.php";
require_once "include/functions.php";
if (session_is_registered(S_ID)) {
    $good = true;
    try {
        $db = GetDBConnect();
        $sys_user = new System_User($db);
        $sys_user->Current();
        $sys_user->Logout();
    } catch (Exception $e) {
        ShowErrPage("Ошибочка", $e->GetMessage());
        $good = false;
    }
    if ($good) {
        session_destroy();
        header("Location: login.php");
        exit;
    }
}