Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $container['view'] = function ($container) {
- $view = new SlimViewsTwig(
- $container['settings']['view']['template_path'],
- $container['settings']['view']['twig'],
- [
- 'debug' => true // This line should enable debug mode
- ]
- );
- $basePath = rtrim(str_ireplace('index.php', '', $container['request']->getUri()->getBasePath()), '/');
- $view->addExtension(new SlimViewsTwigExtension($container['router'], $basePath));
- $view->addExtension(new Twig_Extension_Debug());
- return $view;
- };
- $container['validate_sanitize'] = function ($container)
- {
- $class_path = $container->get('settings')['class_path'];
- require $class_path . 'ValidateSanitize.php';
- $validator = new ValidateSanitize();
- return $validator;
- };
- $container['hash_password'] = function($container)
- {
- $class_path = $container->get('settings')['class_path'];
- require $class_path . 'HashPassword.php';
- $hash = new HashPassword();
- return $hash;
- };
- $app->post('/register', function(Request $request, Response $response)
- {
- $arr_tainted_params = $request->getParsedBody();
- $sanitizer_validator = $this→get('validate_sanitize'); //here for example
- $password_hasher = $this->get('hash_password');
- $tainted_email = $arr_tainted_params['email'];
- $tainted_username = $arr_tainted_params['username'];
- $tainted_password = $arr_tainted_params['password'];
- $model = $this->get('model');
- $sql_wrapper = $this->get('sql_wrapper');
- $sql_queries = $this->get('sql_queries');
- $db_handle = $this->get('dbase');
- $cleaned_email = $sanitizer_validator->sanitize_input($tainted_email, FILTER_SANITIZE_EMAIL);
- $cleaned_username = $sanitizer_validator->sanitize_input($tainted_username, FILTER_SANITIZE_STRING);
- $cleaned_password = $sanitizer_validator->sanitize_input($tainted_password, FILTER_SANITIZE_STRING);
- });
- <?php
- require 'routes/change_password.php';
- require 'routes/forgot_password.php';
- require 'routes/homepage.php';
- require 'routes/login.php';
- require 'routes/logout.php';
- require 'routes/register.php';
- <?php
- session_start();
- require __DIR__ . '/../vendor/autoload.php';
- $settings = require __DIR__ . '/app/settings.php'; //an array of options containing database configurations and the path to twig templates
- $container = new SlimContainer($settings); //not sure what this does
- require __DIR__ . '/app/dependencies.php';
- $app = new SlimApp($container);
- require __DIR__ . '/app/routes.php';
- $app→run();
Add Comment
Please, Sign In to add comment