diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-06-30 11:10:17 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-06-30 11:10:17 +0200 |
commit | 1269889704386de951d7f91eb169eb1e1bb36cc0 (patch) | |
tree | ff0b0fbcf5d6cc6cb769ef25924721e348f339a5 /appli_3_alpha_old/app/auth_dialog.php | |
parent | c93c261a461c9a2359bdcd75f7136fcb05237106 (diff) | |
download | 2007-AWOR-1269889704386de951d7f91eb169eb1e1bb36cc0.tar.gz 2007-AWOR-1269889704386de951d7f91eb169eb1e1bb36cc0.tar.bz2 2007-AWOR-1269889704386de951d7f91eb169eb1e1bb36cc0.zip |
Sous-dossier app entre old4 et old5
Diffstat (limited to 'appli_3_alpha_old/app/auth_dialog.php')
-rw-r--r-- | appli_3_alpha_old/app/auth_dialog.php | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/appli_3_alpha_old/app/auth_dialog.php b/appli_3_alpha_old/app/auth_dialog.php new file mode 100644 index 0000000..36058e0 --- /dev/null +++ b/appli_3_alpha_old/app/auth_dialog.php @@ -0,0 +1,120 @@ +<?php + // Récupération des paramètres + if ( isset($_GET['retour']) && $_GET['retour']!='' ) + { $retour=addslashes( $_GET['retour'] ); } else { $retour='index.php'; } + + // Si le formulaire à été envoyé, on le traite ici + if ( isset($_POST['envoi']) && $_POST['envoi'] === '1' ) + { + if ( ! ( isset($_POST['loginP']) && isset($_POST['pass']) ) ) + { + $errmsg = 'Paramètres incorrects'; + } + else + { + $loginP=addslashes( $_POST['loginP'] ); + + + include 'include/ludo/auth.inc.php'; + + // Code vérifiant que la personne qui tente de se connecter est bien référencée dans notre base + include 'include/ludo/fonctions.inc.php'; + // Connexion à la base et sélection de la database + include 'include/connect.inc.php'; + include 'include/ludo/config.inc.php'; + + // Requete SQL + $query = "SELECT idP, loginP, nomP, prenomP, methodeAuth FROM Personne WHERE loginP='$loginP';"; + if ( ! $result = @mysql_query($query) ) + { + // Cas d'erreur + $errmsg =mysql_generate_errmsg(); + } + else + { + // Initialisation par défaut + $methodeAuth=''; + // Chargement des préférences d'authentification de l'utilisateur + if ( mysql_num_rows($result) === 1) + { + list($idP, $loginP, $nomP, $prenomP, $methodeAuth) = mysql_fetch_row($result); + } + // Si le script est lancé en local, on saute l'authentification + if ( ($CONFIG['AUTH']['bypass_if_local'] === true ) + && ( ($_SERVER['REMOTE_ADDR'] == 'localhost') || ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') ) ) + { + $methodeAuth='bypass'; + } + + $auth_is_ok=false; + switch ( $methodeAuth ) + { + case 'webetud': + // TODO + break; + // Vous pouvez ajouter d'autres mode d'authentification ici ! + case 'bypass': + $auth_is_ok=true; + break; + default: + // Tentative d'authentification POP + if ( ($errno = pop3_auth_simple($loginP, $_POST['pass']) ) != 0 ) + { + // Authentification échouée + $errmsg=pop3_generate_errmsg($errno); + } + else + { + $auth_is_ok=true; + } + break; + } + if ( $auth_is_ok === true ) + { + // Authentification réussie + session_start(); + $_SESSION['session_loginP']=$loginP; + $_SESSION['session_nomP']=$nomP; + $_SESSION['session_prenomP']=$prenomP; + $_SESSION['session_idP']=$idP; + require('include/ludo/redir.inc.php'); + html_redir($retour); + } + } + } + } +require_once('include/ludo/html_elements.inc.php'); +generate_html_doctype_and_head("Identification"); +?> +<body onload="javascript:document.forms['auth'].elements['loginP'].focus()"> +<div id="titre"><h2>AWOR</h2></div> + +<?php +generate_html_div_help(); +?> +<div id="page_accueil"> + <h1>Application Web d'Organisation de Réunion</h1> + <h2>Veuillez vous identifier</h2> + <?php echo '<form id="auth" method="post" action="' . $_SERVER['PHP_SELF'] . '">' . "\n"; ?> + <input type="hidden" name="envoi" value="1" /> + <?php echo '<input type="hidden" name="retour" value="' . $retour . '" />' . "\n" ; ?> + <div class="aligned"> + <div> + <span class="label">Votre identifiant :</span> + <span class="field"><input name="loginP" type="text" size="20" tabindex="1" /></span> + </div> + <div> + <span class="label">Votre mot de passe :</span> + <span class="field"><input name="pass" type="password" size="20" tabindex="2" /></span> + </div> + <div> + <span class="label"><input type="reset" value="Vider" /></span> + <span class="field"><input type="submit" value="Valider" /></span> + </div> + </div> +<?php if ( isset ($debug) ) { echo ' <input type="hidden" name="debug" value="true" />' . "\n"; } ?> + </form> +</div> +<?php if ( isset ($errmsg) ) { generate_html_div_errmsg($errmsg); } ?> +</body> +</html> |