| 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 : |
<?
//error_reporting(E_ALL);
//ini_set('display_errors', "1");
require_once($_SERVER['DOCUMENT_ROOT'].'/php/db_config_lc_user.php');
require_once("{$_SERVER["DOCUMENT_ROOT"]}/lcapi/inc/UserSignup.php");
require_once("{$_SERVER["DOCUMENT_ROOT"]}/lcapi/inc/Logger.php");
$site = (isset($_REQUEST['site']) && $_REQUEST['site'] != '') ? preg_replace('/[^a-zA-Z0-9]/','',$_REQUEST['site']) : '';
$user_id = (isset($_REQUEST['user_id']) && $_REQUEST['user_id'] != '') ? trim($_REQUEST['user_id']) : '';
$type = (isset($_REQUEST['type']) && $_REQUEST['type'] != '') ? trim($_REQUEST['type']) : '';
$response = array();
$json_options = JSON_HEX_AMP;
$recordings = array();
if(!empty($_FILES)) {
//$response['FILES'] = $_FILES;
foreach($_FILES as $file) {
if($file['error'] == '0') {
$recordings[] = $file;
} else if(is_array($file['error'])) {
foreach($file['error'] as $index=>$error) {
if($error == 0) {
$recordings[] = array(
'name'=>$file['name'][$index],
'type'=>$file['type'][$index],
'tmp_name'=>$file['tmp_name'][$index],
'error'=>$error,
'size'=>$file['size'][$index],
);
}
}
}
}
} /*else {
foreach($_FILES as $file)
$response[$file['name']] = $file['tmp_name'];
}*/
//echo "<pre>POST ".print_r($_POST, true)."</pre>";
//echo "<pre>REQUEST ".print_r($_REQUEST, true)."</pre>";
//echo "<pre>FILES ".print_r($_FILES, true)."</pre>";
SendDebug(__FILE__, $debug = array('HTTP_USER_AGENT'=>$_SERVER['HTTP_USER_AGENT']));
if(!$db = connect_lc2user_new('lc2'.$site.'_lc')) {
SendError(__FILE__." at line ".__LINE__, "Failure to connect to database (lc2".$site."_lc). MySQL: ".$db->error());
$response['status'] = 'Failure';
$response['error'] = 'Unable to connect to database.';
die(json_encode($response,$json_options));
}
$user = new UserSignup($db, $site);
if (!$user->LoadUserById($user_id)) {
SendError("LoadUserById() in ".__FILE__." at line ".__LINE__,$user->lasterror);
$response['status'] = 'Failure';
$response['error'] = $user->lasterror;
die(json_encode($response,$json_options));
}
$fileUrls = $user->AddUserRecordings($recordings, $type);
if (!$fileUrls) {
SendError("AddUserRecordings() in ".__FILE__." at line ".__LINE__,$user->lasterror);
$response['status'] = 'Failure';
//$response['error'] = $errors;
$response['error'] = $user->lasterror;
die(json_encode($response,$json_options));
} else if(has_errors($fileUrls)) {
//Success with warning
SendError("AddUserRecordings() in ".__FILE__." at line ".__LINE__, 'SucessWarning. One or more files had errors, see DATA array().', $fileUrls);
}
$response['status'] = 'Success';
$response['data'] = $fileUrls;
die(json_encode($response,$json_options));
function has_errors($files = array()) {
if(!is_array($files) || empty($files)) {
return false;
}
foreach($files as $file) {
if($file['status'] == 'Failure')
return true;
}
return false;
}
/*
*
function array_walk_recursive_referential(&$array, $function, $parameters = array()) {
$reference_function = function(&$value, $key, $userdata) {
$parameters = array_merge(array($value), $userdata[1]);
$value = call_user_func_array($userdata[0], $parameters);
};
array_walk_recursive($array, $reference_function, array($function, $parameters));
}
*/