[PHP] How to check acces to modeuls files and dirs
Good morning, I have got an anrray: $access[]["id"]; $access[]["name"]; and then I browse a "mode" dirs and I need to check if md5(directory_name) exists in access array. I don't want to browse all dirs a list all subdirs files and chech with access array like this: // check where login user has access while($temp = $db -> db_Fetch_Array($check)){ $access[$count]["name"] = $temp["name"]; //mode name, eg. backup $access[$count]["id"] = $temp["id_mod"]; //id dir $count++; } $handle=opendir($ADMIN_DIR); $allow = Array(); while (($mod_name = readdir($handle))!==false) { if(eregi("^(mod.)",$mod_name)){ $mod_id = md5(strtolower($mod_name)); $f_h=opendir($ADMIN_DIR.$mod_name); while (($file_name = readdir($f_h))!==false) { if ($file_name != "." && $file_name != ".." && !in_array($file_name,$non_files)) { foreach($access as $value){ if($value["id"]==$file_name){ $allow[] = $file_name; } } } } } } Have you got some ideas how to solve this problem with lower system requirements? Thank you for your answers. jiri.nemec at menea.cz http://www.menea.cz ICQ: 114651500 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to get tree structure into an array?
Hi all! i have to solve one problem, but i have no idea how to make this. I have got a tree strucutre in mysql table, id - parent - name. I need make function, which return array which will contains a strucutre of this tree-menu, table example: ID Parent Name -- -- -- 1 0 Components 4 1 Main boards 5 1 HD 7 5 IDE 8 5 SCSI and result: $array = Array( "id" => "1", "name" => "Components", "sub" => array( "id" => "4", "name" => "Mainboards", "sub" => no_array (no sub pages)), array( "id" => "5", "name" => "HD", "sub" => Array( "id" => "7", "name" => "IDE", "sub" => no_array (no sub pages)), Array( "id" => "8", "name" => "SCSI", "sub" => no_array (no sub pages)) ) ); an so on, source table has got about 300 items, so i need function which make an array for next work with this tree structure. thanks a lot for some help! jiri.nemec at menea.cz http://www.menea.cz ICQ: 114651500 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiarray
Hi all, i have o question, is there some solution how to make from multi-array no-multi-array? :) i need to make from multi-array this array: $pole[] => "gk" $pole[] => "gk-ati" $pole[] => "gk-nvi" $pole[] => "gk-mat" thank you for all advices! multi-array: --- array(2) { ["code"]=> string(2) "gk" ["sub"]=> array(3) { [0]=> array(2) { ["code"]=> string(6) "gk-ati" ["sub"]=> NULL } [1]=> array(2) { ["code"]=> string(6) "gk-nvi" ["sub"]=> NULL } [2]=> array(2) { ["code"]=> string(6) "gk-mat" ["sub"]=> NULL } } } jiri.nemec at menea.cz http://www.menea.cz ICQ: 114651500 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP, exception and PostgreSQL
Hello, is here somebody who works with PostgreSQL in PHP? I have a PL/SQL function, which can raise an exception. I am not able to catch _only_ exception error message in PHP. I can parse "Warning: pg_query(): Query failed: ERROR: Exception error string. in..." but I think, it is not "clear" solution. Thank you for your reply. -- Jiri Nemec -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php