This readfile() procedure works fine until I add the viewer and login lines for membership. Then the file become corrupted (or something) and won't display.
Can you think of why securing the page is messing with the latter code? See any options I could try to unfetter the readfile() ?
require_once '/myhost/public_html/cmsAdmin/lib/viewer_functions.php';
if (!$CURRENT_USER) {websiteLogin_redirectToLogin();}
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
} // endif