/* Decoded by unphp.net */
include('conexao.php');;echo '';include('funcoes.php');;echo '';include('classes.php');;echo '';
if (!isset($_SESSION)) session_start();
if (!isset($_SESSION['MM_Cliente'])) {
echo "
";
systemAviso("acesso negado...");
exit();
}
$consulta_rsCliente = "SELECT *
FROM sis_cliente
WHERE login = '".anti_injection($_SESSION['MM_Cliente'])."'
LIMIT 1";
$rsCliente = mysql_query($consulta_rsCliente,$mkConn);
$row_rsCliente = mysql_fetch_assoc($rsCliente);
if ($row_rsCliente['contrato'] == "nenhum") {
echo "
";
systemAviso("nenhum contrato definido para o cliente");
exit();
}
$sha1contrato = sha1($_SESSION['MM_Cliente']);
$pdfcontrato = "/usr/local/mkauth/mkfiles/contrato_$sha1contrato.pdf";
shell_exec("sudo rm -rf $pdfcontrato");
shell_exec("sudo /usr/bin/wkhtmltopdf -T 5 -B 5 --no-outline \"http://127.0.0.1/api/geracont.php?username=".$_SESSION['MM_Cliente']."\" $pdfcontrato > /dev/null 2>&1");
if (strstr($_SERVER["HTTP_USER_AGENT"],"MSIE") == false) header("Content-Type: application/pdf");
header("Content-Length: ".filesize($pdfcontrato));
header("Content-Disposition: attachment; filename=\"contrato_$sha1contrato.pdf\"");
header("Content-Transfer-Encoding: binary");
header("Pragma: no-cache");
readfile($pdfcontrato);
mysql_free_result($rsCliente);
exit();
;