debug=true; $mpdf->tabSpaces = 6; $mpdf->allow_charset_conversion=true; $mpdf->charset_in='windows-1252'; //============================================================== preg_match('/example[0]{0,1}(\d+)_(.*?)\.php/',$filename,$m); $num = intval($m[1]); $title = ucfirst(preg_replace('/_/',' ',$m[2])); if (!$num || !$title) { die("Invalid file"); } if (preg_match('/\//', $filename) || !preg_match('/\.php$/',$filename)) { die("Hacking attempt"); } $html = '
'; foreach($lines AS $line) { $html .= htmlspecialchars($line); } $html .= ''; $html .= '