Files
runff/giocatore.php
2019-05-03 21:06:31 +02:00

83 lines
2.2 KiB
PHP

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
/*
Run4Football v0.1
This file is part of Run4Football. (C)2019 Corrado Mulas - CM TLC - R&D Dept. - Ardara (SS)
Run4Football is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Run4Football is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Run4Football. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Description of giocatore
*
* @author corradomulas for Run PoliTo - Corso Duca degli Abruzzi 24, 10129 Torino (TO)
*/
// put your code here
//MAIN:
require '/percorso/simplesamlphp/library/vendor/autoload.php';
require_once '/percorso/simplesamlphp/library/lib/_autoload.php';
require 'lib/r4fb.php';
$auth = new \SimpleSAML\Auth\Simple('nomeSP');
//Auth livello 1:
$auth->requireAuth();
SimpleSAML_Session::getSessionFromRequest()->cleanup();
$guid = $auth->getAttributes()['guid'][0];
$nome = r4fb::fetchUsers($guid)[0]['nome'];
$cognome = r4fb::fetchUsers($guid)[0]['cognome'];
$matr = r4fb::fetchUsers($guid)[0]['matr'];
//Auth livello 2:
$tipo = trim(r4fb::fetchUsers($guid)[0]['tipo']);
if($tipo != 1 && $tipo != 4)
{
$auth->logout();
header("Location: index.php?error=Privilegi insufficienti.");
die();
}
else
{
echo "MESSAGGIO DI BENVENUTO A CAZZO"
. "<form name='logout' action='' method='post'>"
. "<input type='submit' name='logout' value='Logout' />"
. "</form>";
}
if(isset($_POST['logout']))
{
$auth->logout();
}
?>
</body>
</html>