From 2f99e486e5b697db21ef05f8524bf66e272f2189 Mon Sep 17 00:00:00 2001 From: Baptiste Date: Sun, 10 Jul 2022 18:08:53 +0200 Subject: [PATCH] login INSA admin page --- admin/deco.php | 5 +++- admin/gestion_des_acces.php | 12 ++++---- admin/index.php | 57 +++++++++++++++++++++++-------------- 3 files changed, 45 insertions(+), 29 deletions(-) diff --git a/admin/deco.php b/admin/deco.php index 079036f..4957f70 100644 --- a/admin/deco.php +++ b/admin/deco.php @@ -2,5 +2,8 @@ session_start(); $_SESSION = array(); session_destroy(); -header("Location: index.php"); +require_once("../phpCAS-1.3.6/CAS.php"); +phpCAS::client(CAS_VERSION_2_0, "cas.insa-toulouse.fr", 443, 'cas', true); +phpCAS::setNoCasServerValidation(); +phpCAS::logout(); ?> \ No newline at end of file diff --git a/admin/gestion_des_acces.php b/admin/gestion_des_acces.php index 17e5217..19f04b0 100644 --- a/admin/gestion_des_acces.php +++ b/admin/gestion_des_acces.php @@ -70,11 +70,10 @@ if(isset($_GET['adm']) AND !empty($_GET['adm'])) if(isset($_POST['send'])) { - if(isset($_POST['pseudo']) AND !empty($_POST['pseudo']) AND isset($_POST['mdp']) AND !empty($_POST['mdp']) AND isset($_POST['perm']) AND !empty($_POST['perm'])) { + if(isset($_POST['pseudo']) AND !empty($_POST['pseudo']) AND isset($_POST['perm']) AND !empty($_POST['perm'])) { if($user['perm'] >= 2) { $pseudo = htmlspecialchars($_POST['pseudo']); - $mdp = htmlspecialchars($_POST['mdp']); $perm = htmlspecialchars($_POST['perm']); switch ($perm) { @@ -94,8 +93,8 @@ if(isset($_POST['send'])) { $req->execute(array($pseudo)); $pseudo_exist = $req->rowCount(); if ($pseudo_exist == 0) { - $req = $db->prepare("INSERT INTO admin(pseudo, mdp, perm) VALUES(?, ?, ?)"); - $req->execute(array($pseudo, password_hash($mdp, PASSWORD_DEFAULT), $perm_int)); + $req = $db->prepare("INSERT INTO admin(pseudo, perm) VALUES(?, ?)"); + $req->execute(array($pseudo, $perm_int)); header('refresh:0'); } else { $error = "pseudo déja utilisé"; @@ -119,8 +118,7 @@ if(isset($_POST['send'])) {
- - + -