microserviciile de register, login finalizate
This commit is contained in:
Regular → Executable
+25
-41
@@ -1,41 +1,25 @@
|
||||
<?php
|
||||
|
||||
use app\controllers\AuthController;
|
||||
use app\core\Application;
|
||||
use app\controllers\SiteController;
|
||||
|
||||
require_once __DIR__.'/vendor/autoload.php';
|
||||
require_once __DIR__.'/dbconfig.php';
|
||||
|
||||
/*
|
||||
Clasa Application se va ocupa de stocarea asocierilor dintre o pagina si controller-ul corespunzator. Deoarece prin .htaccess am fortat
|
||||
ca user ul sa ajunga mereu in acest 'index.php' la orice URL specificat, putem identifica din URL ce pagina vrea sa acceseze pentru a apela
|
||||
un GET cu controller-ul, view ul si model ul corespunzator, ori printr-un submit sa se ajunga la metoda corespunzatoare de POST care sa intoarca
|
||||
un raspuns valid.
|
||||
*/
|
||||
|
||||
$app = new Application('.', $config);
|
||||
|
||||
$app->router->get('/', [SiteController::class, '/']);
|
||||
|
||||
$app->router->get('/home', [SiteController::class, 'home']);
|
||||
|
||||
$app->router->get('/_404', [SiteController::class, '_404']);
|
||||
|
||||
$app->router->get('/contact', [SiteController::class, 'contact']);
|
||||
$app->router->post('/contact', [SiteController::class, 'contact']);
|
||||
|
||||
$app->router->get('/login', [AuthController::class, 'login']);
|
||||
$app->router->post('/login', [AuthController::class, 'login']);
|
||||
|
||||
$app->router->get('/register', [AuthController::class, 'register']);
|
||||
$app->router->post('/register', [AuthController::class, 'register']);
|
||||
|
||||
$app->router->get('/profile', [AuthController::class, 'profile']);
|
||||
$app->router->post('/profile', [AuthController::class, 'profile']);
|
||||
|
||||
$app->router->get('/logout', [AuthController::class, 'logout']);
|
||||
|
||||
$app->router->get('/login/{id}', [SiteController::class, 'login']);
|
||||
|
||||
$app->run();
|
||||
<?php
|
||||
|
||||
use app\controllers\AuthController;
|
||||
use app\core\Application;
|
||||
use app\controllers\SiteController;
|
||||
|
||||
require_once __DIR__.'/vendor/autoload.php';
|
||||
|
||||
$app = new Application();
|
||||
|
||||
$app->router->get('/', [SiteController::class, 'renderMainPage']);
|
||||
$app->router->get('/homepage', [SiteController::class, 'homepage']);
|
||||
|
||||
$app->router->get('/login', [AuthController::class, 'loginPage']);
|
||||
$app->router->post('/login', [AuthController::class, 'loginPage']);
|
||||
|
||||
$app->router->get('/register', [AuthController::class, 'registerPage']);
|
||||
$app->router->post('/register', [AuthController::class, 'registerPage']);
|
||||
|
||||
$app->router->get('/profile', [AuthController::class, 'profile']);
|
||||
$app->router->post('/profile', [AuthController::class, 'profile']);
|
||||
|
||||
$app->router->get('/logout', [AuthController::class, 'logout']);
|
||||
|
||||
$app->run();
|
||||
Reference in New Issue
Block a user