How to check acces to modeuls files and dirs
| From: | Konference | Date: | Tue, 11 Feb 2003 09:54:10 +0000 |
| Subject: | How to check acces to modeuls files and dirs | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-135178@lists.php.net to get a copy of this message | ||
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