<?php

$nom = '';
$prenom = '';
$systeme = '';
$icon = 'fa-circle-question';

$systemes = [
	1 => ['nom' => 'Linux', 'icon' => 'fa-linux'],
	2 => ['nom' => 'Windows', 'icon' => 'fa-windows'],
	3 => ['nom' => 'macOS', 'icon' => 'fa-apple'],
	4 => ['nom' => 'Android', 'icon' => 'fa-android'],
];

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
	$nomSaisi = trim((string) filter_input(INPUT_POST, 'nom', FILTER_UNSAFE_RAW));
	$prenomSaisi = trim((string) filter_input(INPUT_POST, 'prenom', FILTER_UNSAFE_RAW));
	$os = filter_input(INPUT_POST, 'os', FILTER_VALIDATE_INT);

	$nom = ucfirst(strtolower($nomSaisi));
	$prenom = ucfirst(strtolower($prenomSaisi));

	if (isset($systemes[$os])) {
		$systeme = $systemes[$os]['nom'];
		$icon = $systemes[$os]['icon'];
	}
}
