mirror of
https://github.com/mivodev/mivo.git
synced 2026-01-27 05:52:03 +07:00
16 lines
346 B
PHP
16 lines
346 B
PHP
<?php
|
|
|
|
namespace App\Middleware;
|
|
|
|
class AuthMiddleware implements MiddlewareInterface {
|
|
public function handle($request, \Closure $next) {
|
|
// Assume session is started in index.php
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header('Location: /login');
|
|
exit;
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|