/
login.php
45 lines (31 loc) · 978 Bytes
/
login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Created by PhpStorm.
* User: Home
* Date: 05.11.2015
* Time: 22:32
*/
include_once $_SERVER['DOCUMENT_ROOT'] . '/Controllers/LoginController.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/Model/LoginModel.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/View/LoginView.php';
//initiate the triad
$model = new LoginModel();
//It is important that the controller and the view share the model
$controller = new LoginController($model);
$view = new LoginView($model);
session_start();
if(isset($_SESSION['login_user'])){
if($_SESSION['language'] !== 'us') {
header('Location: /' . $_SESSION['language'] . '/account/');
} else {
header('Location: /account/');
}
}
$controller->actionGenerateSessionAuth();
$_SESSION['session_auth'] = $model->getSessionAuth();
session_write_close();
$controller->actionGetHeaderCart();
$view->DoctypeView( 'Login' );
$view->headerView();
$view->displayLoginErrors();
$view->getLoginForm();