You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.7 KiB

<?php
$ajax = isset($_GET['ajax']) ? $_GET['ajax'] : null;
$token = isset($_GET['token']) ? $_GET['token'] : null;
$prv = isset($_GET['prv']) ? $_GET['prv'] : null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
if($action == 'download'){
downloadPrv();
exit;
}
if (!isset($_SESSION['SSTokenPrivacidade']) && !$ajax) {
$_SESSION['SSTokenPrivacidade'] = md5(date('ymd H:i:s'));
}
$infoLog = json_encode(['iphost' => $_SERVER["REMOTE_ADDR"], 'data_reg' => date('Y-m-d H:i:s')]);
if ($token == $_SESSION['SSTokenPrivacidade'] && $prv == 1 && $ajax) {
$query = "UPDATE pbx_usuarios SET termo_uso_privacidade = 1, termo_uso_log = '$infoLog' WHERE id = '{$_SESSION["SSidUser"]}' AND matricula = '{$_SESSION["SSmatriculaUser"]}';";
if(pg_query($dbcon, $query)){
$_SESSION["SSTermoUsoPrivacidade"] = 1;
echo 'OK';
} else {
echo 'ERROR';
}
exit();
}
$smarty->assign("token", $_SESSION['SSTokenPrivacidade']);
$smarty->display('termoUsoPrivacidade.tpl');
function downloadPrv(){
$file = __DIR__ . '/doc/lgpd/TERMO_DE_USO_E_PRIVACIDADE_APLICACAO_SIMPLES.pdf';
$fsize = filesize($file);
header('Content-Description: File Transfer');
header('Content-Transfer-Encoding: binary');
header('Content-Type: ' . GetMimeContentType($file));
if ($fsize)
header('Content-Length: ' . $fsize);
header('Content-Disposition: attachment; filename="TERMO_DE_USO_E_PRIVACIDADE_APLICACAO_SIMPLES.pdf"');
header('Connection: close');
readfile($file);
exit;
}