Create php mvc app. Make authorization in application
We continue to develop our php mvc app and we will make authorization mechanism in our app today.Last lesson we created form. Today we’ll make some changes and also dynamic avatar image changing depending on the user entered data.
First of all we must create .htaccess file in the root of our application. It is necessary to walk between application pages correctly. I notice, we don’t this pages directly on the server. In real all requests index.php handles. Such approach is called FromController.
For implementation authorization mechanism we must create method in IndexModel, which will return false, if user data from form is not correct, or redirect us to cabinet main page.
This method we will call in index method of IndexController, if $_POST is not empty.
As as homework you can implement registration mechanism and send me to my email – email@example.com. First work I put on the server.