2019 m. rugpjūčio 27 d., antradienis

detect spamming sript

Pirmiausia, žiūrėti mail log:
1829AB7A07E3: uid=48 from=<aaa@bbb.lt>
Pirmas stulpelis - mail quue id, antras - proceso id, kuris siunčia.

php.ini turi būti nustatyta:  mail.add_x_header = On

postcat -q <ID>      - pagal mail que id pažiūrėti laišką
postcat -q DA5E8647235C | grep X-PHP-Originating-Script

X-PHP-Originating-Script: 45:badmailer.php
The number 45 is the UID, which is the Linux user ID that ran the script

postcat -q DA5E8647235C | grep sasl_username

Resend messages in the queue:   postqueue -f

Pastaba: susitvarkus, paleisti   postsuper -d ALL  
nes kitaip dar  tukstanciai padetu laisku gali buti.

Papildomai, iš išorės galima blokuoti SMTP (jungiantis iš servo rašyti localhost): 
iptables -A INPUT -p tcp -s localhost --dport 25 -j ACCEPT 

2019 m. balandžio 21 d., sekmadienis

phpexcel, pdf


/*

$objWriter = PHPExcel_IOFactory::createWriter($doc, 'HTML');
$objWriter->writeAllSheets();

//$objWriter->generateStyles(false);
//echo $objWriter->generateSheetData();
//exit;

$objWriter->save('php://output'); exit;


$css = <<<HTML
<style>
.navigation {display:none}
.gridlines td {border:0;}
</style>
HTML;

require_once('class/pdf/pdftk.php');
ob_start(); 
$objWriter->save('php://output');
$excelOutput = ob_get_clean();
$excelOutput = str_replace('</head>',  $css.'</head>' , $excelOutput);
pdftk::html2pdf($excelOutput,'aaa.pdf', 'L', 'I');
exit;

*/

PHPExcel_Settings::setPdfRenderer(PHPExcel_Settings::PDF_RENDERER_MPDF,'../composer/vendor/mpdf/mpdf/');

$objWriter = PHPExcel_IOFactory::createWriter($doc, 'PDF');
$objWriter->writeAllSheets();
header('Content-type:Application/pdf'); 
header('Content-Disposition: inline;filename="export.pdf"');
$objWriter->save('php://output');

exit;