diff --git a/metadata/dbms/records.php b/metadata/dbms/records.php index 63406e7..1777b40 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; } @@ -278,7 +280,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); @@ -291,7 +293,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 - ассоциативный массив значений, ключи - названия столбцов @@ -303,7 +305,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 - ассоциативный массив значений, ключи - названия столбцов @@ -915,7 +917,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++) {