Download application development for managing and - e

Transcript
APPLICATION DEVELOPMENT FOR MANAGING AND
MONITORING A DATA CENTRE
Then we have some utility classes, for instance, logout.php, which is responsible of
freeing the resources from a PHP session once the user logs out. Then we also have
check_if_logged.php; this class is responsible of checking if the user is properly logged
in the system. And finally we have check_login.php; this class is responsible of logging
users into the system if they provide a valid username and password; as well as creating
a proper session instance for this user to identify him.
We have by other hand, the component includes, who is responsible of defining very
common general operations in the system; for instance, connecting to database. All
“committers” in logic component connect to database by using PDO interface. We
extracted some steps that are always performed, and instead of writing them again and
again, we just “include” them using a PHP directive to include code from other PHP
files.
A very important class is filter_functions.php, which is responsible of providing
essential functions for validating, filtering and sanitizing all the user inputs from user
interface. This class is also a security measure to avoid XSS attacks and SQL injection.
We have to highlight that SQL injection is prevented in the three layers: JS escapes the
content before sending; PHP filters and escape the content as well; PDO interface
provides prepared statements, which are theoretically immune to SQL injection.
Many classes depends on check_if_logged class because they do not carry out their
requested operation is the user does not have a valid session initiated.
Some other classes in includes component are just some content almost static, but we
included it as PHP because if it changes in one site, it changes in the other places as
well. For instance, the footer: maintaining changes is really easy if we use include
directive of PHP because then we only have to change one file in the whole system, and
it will be different in every page.
Aitor Pérez Cedrés
Página 60 de 97