0) sort($GLOBALS["users"]); // Make PHP-File $content='"; // Write to File if( !is_writable(_EXT_PATH."/config/.htusers.php") && !chmod( _EXT_PATH."/config/.htusers.php", 0644 ) ) { return false; } file_put_contents( _EXT_PATH."/config/.htusers.php", $content); return true; } //------------------------------------------------------------------------------ function &ext_find_user($user,$pass) { $return = null; $cnt=count($GLOBALS["users"]); for($i=0;$i<$cnt;++$i) { if($user==$GLOBALS["users"][$i][0]) { if($pass===NULL || ($pass==$GLOBALS["users"][$i][1] && $GLOBALS["users"][$i][7])) { return $GLOBALS["users"][$i]; } } } return $return; } //------------------------------------------------------------------------------ function ext_update_user($user,$new_data) { $data=&ext_find_user($user,NULL); if($data==NULL) return false; $data=$new_data; return ext_save_users(); } //------------------------------------------------------------------------------ function ext_add_user($data) { if(ext_find_user($data[0],NULL)) return false; $GLOBALS["users"][]=$data; return ext_save_users(); } //------------------------------------------------------------------------------ function ext_remove_user($user) { $data=&ext_find_user($user,NULL); if($data==NULL) return false; // Remove $data=NULL; // Copy Valid Users $cnt=count($GLOBALS["users"]); for($i=0;$i<$cnt;++$i) { if($GLOBALS["users"][$i]!=NULL) $ext_save_users[]=$GLOBALS["users"][$i]; } $GLOBALS["users"]=$ext_save_users; return ext_save_users(); } //------------------------------------------------------------------------------ /* function num_users($active=true) { $cnt=count($GLOBALS["users"]); if(!$active) return $cnt; for($i=0, $j=0;$i<$cnt;++$i) { if($GLOBALS["users"][$i][7]) ++$j; } return $j; } */ //------------------------------------------------------------------------------ ?>