Files
runff/giocatore.php
2019-04-29 16:09:00 +02:00

91 lines
2.5 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 '/sda1/www/idp.runpolito.ml/vendor/autoload.php';
require_once '/sda1/www/idp.runpolito.ml/lib/_autoload.php';
require 'lib/r4fb.php';
//require 'lib/sns.php';
//session_start();
$auth = new \SimpleSAML\Auth\Simple('runpolito-sp');
/*if (!$auth->isAuthenticated()) {
SimpleSAML_Session::getSessionFromRequest()->cleanup();
// Show login link.
print('<a href="/login">Login</a>');
}*/
//Auth livello 1:
$auth->requireAuth();
SimpleSAML_Session::getSessionFromRequest()->cleanup();
//print_r($auth->getAttributes());
$guid = $auth->getAttributes()['guid'][0];
//print_r(r4fb::fetchUsers($guid));
$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']);
//print $tipo;
if($tipo != 1 && $tipo != 4)
{
$auth->logout();
header("Location: index.php?error=Privilegi insufficienti.");
die("su cunnu e tzia rua bagassa");
}
else
{
echo "Ciao merda"
. "<form name='logout' action='' method='post'>"
. "<input type='submit' name='logout' value='Logout' />"
. "</form>";
}
if(isset($_POST['logout']))
{
$auth->logout();
}
?>
</body>
</html>