Reputation: 302
My files are organized with the MVC
pattern (Model, View, Controller).
How am I supposed to protect files in these folders from direct access?
For example, I would like to forbid user to write manually "http://VIEW/blabla". Indeed, the only files which would be supposed to be accessible are outside the folders. They just call, with 'include' php function, the other files contained in VIEW, CONTROLLER and MODEL.
If I protect these folders, when I have something like :
<form action="MODEL/userCreate.php" method="post" id="form">
Will the code be blocked by my protection?
Upvotes: 1
Views: 77
Reputation: 300975
Put those folders outside your document root
/project
/src <-------------your code, not served over http
MyClass.php
/web <-------------your document root, served over http
index.php
Upvotes: 1