Files
keliopanel-v1/0.8.0/system/librairie/lib.securite.php
2016-02-21 01:33:05 +01:00

70 lines
2.2 KiB
PHP
Executable File

<?php
// Page contenant la verification de l'existance du login
/*
Copyright (C) 2007 Mercier Benjamin
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function VerifDroit ()
{
global $MySql;
if ( isset($_SESSION['Utilisateur']) && isset($_SESSION['Hash']) )
{
$SelectUtilisateur = $MySql->Select ("*", "utilisateur", "Utilisateur='".$_SESSION['Utilisateur']."'", "", "", "", "");
if ( $SelectUtilisateur != FALSE )
{
if ( $SelectUtilisateur[0]["Password"] != $_SESSION['Hash'] OR $SelectUtilisateur[0]["Status"] == '5' )
{
//session_destroy ();
Redirect ('http://www.kelio.asso.fr#s1');
}
else
{
$MySql->Update ("utilisateur", array("AdresseIP", "DernierLogin"), array($_SERVER['REMOTE_ADDR'], 'NOW()'), "Utilisateur='".$_SESSION['Utilisateur']."'");
$Offre = $MySql->Select("*", "offre", "id='{$SelectUtilisateur[0]["Offre_id"]}'", "", "", "", "");
$_SESSION['Offre'] = $Offre[0];
}
}
else
{
//session_destroy ();
Redirect ('http://www.kelio.asso.fr#s2');
}
}
else
{
//session_destroy ();
Redirect ('http://www.kelio.asso.fr#s3');
}
}
function VerifProvenance ($Provenance)
{
if ( !preg_match("#".addslashes($Provenance)."#i", $_SERVER['HTTP_REFERER']) )
{
Redirect ('http://www.kelio.asso.fr#5');
}
}
function disconnect ()
{
session_start();
$_SESSION=array();//on efface toutes les variables de la session
session_destroy(); // Puis on détruit la session
Redirect ('http://www.kelio.asso.fr#deconnexion'); // On renvoie ensuite sur la page d'accueil
}
?>