include('common_admin_inc.htm'); if ($_SERVER[REQUEST_METHOD] == "POST") { error_log("_POST = ". print_r($_POST, true) ); $operation = $_POST['operation']; $fileName = $_POST['fileName']; error_log("operation = ". $operation ); error_log("fileName = ". $fileName ); if ($operation == "download") { if (file_exists($fileName)) { $size = filesize($fileName); header("Pragma: "); header("Cache-Control: "); header("Content-Type: application/bin"); header("Content-Length: $size"); header('Content-Disposition: attachment; filename="' . basename($fileName) . '"'); header("Content-Location: $fileName"); header("Cache-Control: private"); $handle = fopen($fileName, "r"); fpassthru($handle); unlink($fileName); } else { echo ""; } return; } else { $operationInProgress = true; $status = new ReturnStatus(); // pcr18062: InAscii checkbox has been removed. Force Ascii snapshot. $bInBin = false; if ($operation == "email") { $emailAddress = $_POST['emailAddress']; capture_state($user, $fileName, $bInBin, $emailAddress); if (file_exists($fileName)) unlink($fileName); } else if ($operation == "browser") { error_log("capture_state($user, $fileName, ".($bInBin?'true':'false').");"); capture_state($user, $fileName, $bInBin); if (file_exists($fileName) && !filesize($fileName)) { $status->setErrorCode( 0x51002 ); if (file_exists($fileName)) unlink($fileName); } } print $status->out(); return; } } // Generate a temporary filename on the initial get $fileName = get_snapshot_filename($user); //"/tmp/snapshot-" . date("m_d_y-His"); error_log("-- Using ". $fileName ." for the snapshot file."); // Test for email configuration $emailConfig = get_email_configuration($user); ?>