html - php encoding snippet and displaying correct format after download -


i have php code write snippet inside file in root directory, when writing file encode using htmlentities($_post['filecontentcode'], ent_quotes, "utf-8"); when owner want view use php code read file , display using parameter root/index.php?read=demo.html face big problem don't know how fix when thought have solution still not.

my problems 1 when users try access root/demo.html browse file direct instead of using view option give, there way denied them access browsing file direct except few want browse using htaccess or php?

2 thou when browse direct not run html or execute program write because encoded htmlentities($_post['filecontentcode'], ent_quotes, "utf-8"); before writing file bigger problem come when download file display in format bellow

<!doctype html> <html lang="en"> <head> <title>index </title>

this what don't know how fix again stock here, there way display file correctly when download or way prevent file executing when browse direct or remove encoding htmlentities($_post['filecontentcode'], ent_quotes, "utf-8"); when saving file? please need help.

here have in htaccess not working

#<files *.php>     <files ~ "^.*\.([php][html][pt][htm][xml][xhtml][php][html][pt][htm][xml][xhtml][*])">         order deny,allow         deny         allow 127.0.0.1     </files>     # want accessible      <files index.php|cjlpro1.php>         order allow,deny         allow     </files> 


Comments

Popular posts from this blog

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -

php - Autoloader issue not returning Class -