Saturday, 15 March 2014

Deny access to php file except to process HTML forms -



Deny access to php file except to process HTML forms -

i using phpmailer email myself info html forms submitted on website. have file mydomain.com/mail/mailer.php must contain password email account. want deny access mydomain.com/mail/ protect file , maintain people out of there. when "deny all" in .htaccess in mydomain.com/mail/, forms stop working due 403 error.

how allow html forms @ mydomain.com processed while denying access else?

my mailer script redirects success page outside of mail service subdirectory, not problem. 403 happening before script succeeds in emailing me form data.

i tried "order allow,deny / deny / allow mydomain.com". got 403 before email sent.

just because code contains password not mean people can see it. if goes url code executes, doesn't dump code browser if that's worried about. if have forms post/get script of course of study script must available (not protected via .htaccess deny rules etc.) having said can split configuration separate file include (eg. config.php) , protect file:

eg.

/myfolder/myform.php /myfolder/config.php

in case above, can have myform.php include 'config.php' , add together deny rule .htaccess preventing access config.php

example /myfolder/.htaccess entry:

<files "config.php"> order deny,allow deny </files>

php html forms .htaccess phpmailer

No comments:

Post a Comment