MV framework logo
  • Architecture
  • Philosophy
  • Admin panel
  • Support
  • Feedback
Documentation
Download .zip version 3.2.0 from 25.12.2024
  • Architecture
  • Philosophy
  • Admin panel
  • Support
  • Feedback
Getting started
  • Installation and launch
  • Folder structure
  • Launching a simple website
  • Pre-installed models
  • SQLite getting started
  • System settings
  • Migrations
  • Debugging
Models
  • General principles of models
  • Data types
  • Model setup
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Managing simple models
  • Additional features
Templates and routing
  • General principles of templates
  • Router object
  • MV object
  • Create a new template
  • Output of data in template
  • Record object
  • Files and images
  • Date and time
  • Redirects and http
  • Sending email
  • Special methods
Forms
  • Creating forms
  • Setting up form fields
  • Validating form fields
  • Form security
  • Working with form data
  • Using data from models
  • Form methods
SQL queries
  • Query builder
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
Additional
  • AJAX
  • Plugins
  • Caching
  • Security
  • Admin panel add-ons
Documentation
Getting started
  • Installation and launch
  • Folder structure
  • Launching a simple website
  • Pre-installed models
  • SQLite getting started
  • System settings
  • Migrations
  • Debugging
Models
  • General principles of models
  • Data types
  • Model setup
  • Simple models
  • Foreign keys
  • Trees
  • Many to many
  • Group
  • Records management
  • Managing simple models
  • Additional features
Templates and routing
  • General principles of templates
  • Router object
  • MV object
  • Create a new template
  • Output of data in template
  • Record object
  • Files and images
  • Date and time
  • Redirects and http
  • Sending email
  • Special methods
Forms
  • Creating forms
  • Setting up form fields
  • Validating form fields
  • Form security
  • Working with form data
  • Using data from models
  • Form methods
SQL queries
  • Query builder
  • Direct queries
  • Pagination
  • Sorting
  • Filtration
Additional
  • AJAX
  • Plugins
  • Caching
  • Security
  • Admin panel add-ons
MV tracker

Security

Production mode

The development/production mode is switched via the .env file in the project root. In production mode, all errors and warnings are written to the log folder, and the user is shown a 404 error.

APP_ENV=production
On the production server, the project must be in production mode only.

Protection against SQL injections

Before substituting values ​​into an SQL query without using the constructor, they must be processed by the special secure() function. This method is contained in the Database class and is available in the $db object, which is located in each model and plugin.

Query builder independently applies the secure() method to incoming data. If you are using Direct queries, then when calling the secure() method, you do not need to enclose the value in single quotes.

 $db -> getRow("SELECT * FROM `products`
                WHERE `active`='1'
                AND `type`=".$this -> db -> secure($param));

//For integer values, it is better to use the intval() function
$row = $this -> db -> getRow("SELECT * FROM `table`
                              WHERE `id`='.intval($param)."'");

Admin panel security

  • After two unsuccessful authorization attempts, the user is prompted to enter CAPTCHA.
  • Password recovery only after entering captcha and confirming via email link.
  • Binding a session to a browser and IP address.
  • Tokens to prevent CSRF during operations in admin panel.
  • Logging out a user by timeout, with the ability to autologin.

URL in the Router object

In the Router object, a single quote is removed from the URL, while the GET parameters remain in their original form and if they are used in direct requests, you must call the secure() method from the database object.

Using a CSRF token for forms

Detailed description in the section Form security.

$form = new Form(...);
$form -> useTokenCSRF();

Previous section

Caching

Next section

Admin panel add-ons
MV workshop banner
MV tracker

© 2014-2025, MV framework team

MV tracker project Github