From 45431e6aa82f8bc309d9a32d5cc503981ae3bc88 Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 22 Oct 2020 19:53:44 +0600 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B5=D1=81=D1=81=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- metadata/dbms/records.php | 12 +++++++----- metadata/include/session.php | 23 +++++++++++++++++++++++ metadata/include/tools.php | 2 +- metadata/tree/tree.js | 6 +++--- metadata/update/test.php | 2 +- 5 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 metadata/include/session.php diff --git a/metadata/dbms/records.php b/metadata/dbms/records.php index 98e8f7e..e66f4e9 100644 --- a/metadata/dbms/records.php +++ b/metadata/dbms/records.php @@ -10,7 +10,9 @@ //if(isset($_GET[session_name()]) && $_GET[session_name()]!='') //Чтоб сессия переданная гетом была главней // session_id($_GET[session_name()]); - @session_start(); + + startSession(true); //Для ручного определения времени жизни сесии + if(isset($_SESSION['REMOTE_ADDR']) && $_SESSION['REMOTE_ADDR'] != $_SERVER['REMOTE_ADDR']) unset($_SESSION['USER_ID']); //Делаемся не авторизованным если зашли с другого ip адреса if(!isset($_SESSION['USER_ID'])) { $_SESSION['USER_ID']=null; } if(!isset($_COOKIE['GUID'])) { $_COOKIE['GUID']=null; } @@ -274,7 +276,7 @@ //Вернём значение прав доступа для запрошенного объекта //$allow=true; $allow=false; - //$sql_query='select a.*,at.name from "_Access" a, "_Actions" at where a.del=false and at.id=a.action_id and at.name=\'Insert_'.$typename.'\' and a.group_id in (select group_id from "_UsersGroups" where user_id='.$_SESSION['USER_ID'].');' + //$sql_query='select a.*,at.name from _Access a, _Actions at where a.del=false and at.id=a.action_id and at.name=\'Insert_'.$typename.'\' and a.group_id in (select group_id from _UsersRoles where user_id='.$_SESSION['USER_ID'].');' $sql_query='select '.$Schema.'p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Insert_'.$typename.'\') as allow;'; $res = $db->query($sql_query); @@ -287,7 +289,7 @@ $currNode->setAttributeNode($xmlAttr); $allow=false; - //$sql_query='select a.*,at.name from "_Access" a, "_Actions" at where a.del=false and at.id=a.action_id and at.name=\'Update_'.$typename.'\' and a.group_id in (select group_id from "_UsersGroups" where user_id='.$_SESSION['USER_ID'].');'; + //$sql_query='select a.*,at.name from _Access a, _Actions at where a.del=false and at.id=a.action_id and at.name=\'Update_'.$typename.'\' and a.group_id in (select group_id from _UsersRoles where user_id='.$_SESSION['USER_ID'].');'; $sql_query='select '.$Schema.'p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Update_'.$typename.'\') as allow;'; $res = $db->query($sql_query); while ($row = $res->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов @@ -299,7 +301,7 @@ $currNode->setAttributeNode($xmlAttr); $allow=false; - //$sql_query='select a.*,at.name from "_Access" a, "_Actions" at where a.del=false and at.id=a.action_id and at.name=\'Delete_'.$typename.'\' and a.group_id in (select group_id from "_UsersGroups" where user_id='.$_SESSION['USER_ID'].');'; + //$sql_query='select a.*,at.name from _Access a, _Actions at where a.del=false and at.id=a.action_id and at.name=\'Delete_'.$typename.'\' and a.group_id in (select group_id from _UsersRoles where user_id='.$_SESSION['USER_ID'].');'; $sql_query='select '.$Schema.'p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Delete_'.$typename.'\') as allow;'; $res = $db->query($sql_query); while ($row = $res->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов @@ -910,7 +912,7 @@ if($cmd==0) //Restore password by email { - $res = $db->query("select 1 from \"_Users\" where del=false and email = '$login';"); + $res = $db->query("select 1 from _Users where del=false and email = '$login';"); if($res->rowCount()>0) { mail($login,'BigFootTrade.kz','Not implement',"Content-type: text/html; charset=utf-8\r\nFrom: BigFootTrade Site "); diff --git a/metadata/include/session.php b/metadata/include/session.php new file mode 100644 index 0000000..152c709 --- /dev/null +++ b/metadata/include/session.php @@ -0,0 +1,23 @@ += $sessionLifetime ) + { + $t=$_SESSION['lastactivity']; + session_unset(); + $_SESSION['lastactivity']=$t; + return false; + } + return true; +} \ No newline at end of file diff --git a/metadata/include/tools.php b/metadata/include/tools.php index f9b66e9..2439544 100644 --- a/metadata/include/tools.php +++ b/metadata/include/tools.php @@ -16,7 +16,7 @@ function trt($text) global $db; $result=''; - $sql='select translation from main._translations where del=false and language_id='.$_SESSION["LNG"].' and identifier=\''.$text.'\';'; + $sql='select translation from _translations where del=false and language_id='.$_SESSION["LNG"].' and identifier=\''.$text.'\';'; //$sql='select translation from main._translations where del=false and language_id=(select id from main._languages where short_name=\''.$_SESSION["LNG"].'\') and identifier=\''.$text.'\';'; $res = NULL; try diff --git a/metadata/tree/tree.js b/metadata/tree/tree.js index 57f3304..4fb377c 100644 --- a/metadata/tree/tree.js +++ b/metadata/tree/tree.js @@ -255,7 +255,7 @@ function TMenu(v_obj,v_scr,v_treepath) //Горизонтальное меню if(ptn.wch) //TODO проверить нужно или нет здесь { - cnt.innerHTML=' Подождите пожалуйста...'; + cnt.innerHTML=' Подождите пожалуйста...'; return; } for(var i=0;iquery('select * from "_Users"'); + /*$res = $db->query('select * from _Users'); //Записываем id типов столбцов for($i=0;$i<$res->columnCount();$i++) {