start_time = $mtime; } function end_timer() { $mtime = microtime (); $mtime = explode (' ', $mtime); $mtime = $mtime[1] + $mtime[0]; $end_time = $mtime; $total_time = round (($end_time - $this->start_time), 5); return $total_time; } } class info { var $input=array(); function info() { } function validate_input() { //global $input; //0 - browse a folder //1 - show a file //2 - download files //3 - remove files //4 - chmod files or folders //5 - upload files into this folder //6 - show file owner, group //7 - edit a file //8 - rename a file or folder $NA=8; if($this->is_set('cmd')) $this->input['action']=intval($this->get_var('cmd_action',0)); $this->input['action']=$this->number('action',0,$NA,0); $tmp=$this->get_var('entry',getcwd()); //the entry $tmp=str_replace('\\','/',$tmp); $tmp=str_replace('//','/',$tmp); $tmp=rtrim($tmp,'/'); $tmp=rtrim($tmp); $this->input['entry']=$tmp; } function number($name,$min,$max,$def=0) { $var=0; if(isset($this->input[$name])) $ret=$this->input[$name]; else $ret=$def; if($ret>$max) $ret=$max; if($ret<$min) $ret=$min; return $ret; } function get_var($var_name,$def_var) { if(isset($this->input[$var_name])) $ret=$this->input[$var_name]; else $ret=$def_var; return $ret; } function is_set($var_name) { return isset($this->input[$var_name]); } function load_module() { //global $this->input; $modules=array( 0=>'browse', 1=>'show', 2=>'download', 3=>'remove', 4=>'chmod', 5=>'upload', 6=>'showstat', 7=>'edit', 8=>'rename', ); $module='./'.$modules[$this->input['action']].'.php'; if(file_exists($module)) require $module; else die('Not yet support'); } }//of class $dbg=new debug(); $std=new FUNC(); $idx=new info(); $idx->input=$std->parse_incoming(); $idx->validate_input(); $idx->load_module(); ?>