File count: " .$cF;
$cFu = count($_FILES['uploaded']);
//echo "\n
FILES['uploaded'] count: " . $cFu . "
";
$rQ = count($_REQUEST);
//deal with ISO-8859-1
$soundStr = $_POST['SentSound'];
$strType = mb_detect_encoding("test");
$soundStr2 = mb_convert_encoding($_POST['SentSound'], "ISO-8859-1");
$soundStr3 = iconv("UTF-8","ISO-8859-1".'//IGNORE', $_POST['SentSound']);
$soundStr4 = mb_convert_encoding($_POST['SentSound'], "UTF-16");
$soundStr5 = iconv("UTF-8","UTF-16".'//IGNORE', $_POST['SentSound']);
//file_put_contents("ASONG/ASONG" . $_POST['TimeStamp'] . ".VC3", $soundStr);
file_put_contents($dir. DIRECTORY_SEPARATOR . "ASONG" . $selfTimeStamp . ".VC3", $soundStr);
//file_put_contents("ASONG".$_POST['TimeStamp']."data.TXT", "Length2: " . strlen($soundStr). "\nEncoding: " .$strType);
file_put_contents($dir. "data.TXT",
"aSoundPHPupload5h.php data result:\nTimeStamp: " . $_POST['TimeStamp']
. "\n\nSelfTimeStamp: " . $selfTimeStamp
. "\n\nLength POST: " . strlen($_POST['SentSound']). "\nEncoding: " . mb_detect_encoding($_POST['SentSound'])
. "\n\nLength str: " . strlen($soundStr) . "\nEncoding : " . mb_detect_encoding($soundStr)
. "\n\nLength conv2(mb_convert_encoding to ISO-8859-1): " . strlen($soundStr2) . "\nEncoding : " . mb_detect_encoding($soundStr2)
. "\n\nLength conv3(iconv to ISO-8859-1): " . strlen($soundStr3) . "\nEncoding : " . mb_detect_encoding($soundStr3)
. "\n\nLength conv4(mb_convert_encoding to UTF-16): " . strlen($soundStr4) . "\nEncoding : " . mb_detect_encoding($soundStr4)
. "\n\nLength conv5(iconv to UTF-16): " . strlen($soundStr5) . "\nEncoding : " . mb_detect_encoding($soundStr5)
. "\n\nFILES count: " . $cF
. "\nFILES['uploaded'] count: " . $cFu
. "\n\nREQUEST count: " . $rQ
);
}
elseif($_POST['func'] == "GetVC")
{ // get next voice chat file
//echo "Top of the morning to yah.";
$VC3Str = `ls -tr JVCFiles/*.VC3`; // change manually if change $dir
if($_POST['lastSound'] != ""){
$sp = strpos($VC3Str, $_POST['lastSound']) + strlen($_POST['lastSound']);
$VC3Str = substr($VC3Str, $sp);
}
$VC3List = split("\n",$VC3Str);
foreach ($VC3List as $VC3file) {
if($VC3file != "" ){
echo $VC3file . "\n";
$fp = fopen($VC3file, 'rb');
fpassthru($fp);
break;
}
}
// echo "sp: " . $sp . " " . $VC3Str;
}
//end if
// echo "func = " . $_POST['func'];
elseif($_POST['func'] == "GetLastVC")
{ // get next voice chat file
//echo "Top of the morning to yah.";
$VC3Str = `ls -tr JVCFiles/*.VC3`; // change manually if change $dir
// $VC3Str = `ls -tr ` . $dir. DIRECTORY_SEPARATOR . `*.VC3`;
$VC3List = split("\n",$VC3Str);
$VC3ListCount = count($VC3List);
if($VC3ListCount > 1){
echo $VC3List[$VC3ListCount-2];
}
}
?>