<?php

if (session_status() === PHP_SESSION_NONE) {
  session_start();
}

if (!isset($_SESSION['username'])) {

  $name = @$_POST['username'];
  $password = @$_POST['password'];

  if ($name !== 'sayvour' || $password !== 'admin') {
    header('Location: /local/login.php');
    exit;
  }
  else {
    $_SESSION['username'] = $name;
  }
}

header('Location: /local/messages.php');

?>