1234567891011121314151617181920212223242526272829303132 |
- <?php
- require_once('../templates/templates.php');
- $template = getTemplate('admin_login.html');
- $context = ['errors' => '','post_url' => '../admin/login.php'];
- function errorMessage () {
- global $context;
- $errorAlert = getTemplate('error_alert.html');
- $context['errors'] = parseTemplate($errorAlert, ['message'=>'Error. Certifique-se que os dados informados estão corretos']);
- }
- if (!empty($_POST)) {
- require_once('../controller/forms.php');
- require_once('../config/linequest.php');
- require_once('../controller/validator.php');
- global $CFG;
- Validator::check(['senha'], $_POST);
- $password = Validator::str($_POST['senha']);
- try {
- $valid = strcmp($password, $CFG->viewpass) === 0;
- if ($valid) {
- session_start();
- $_SESSION['auth'] = md5($password.time());
- header('Location: index.php');
- exit;
- }
- errorMessage();
- } catch (Exception $e) {
- errorMessage();
- }
- }
- echo parseTemplate($template, $context);
|