diff options
Diffstat (limited to 'final/app/profil.php')
-rw-r--r-- | final/app/profil.php | 56 |
1 files changed, 45 insertions, 11 deletions
diff --git a/final/app/profil.php b/final/app/profil.php index 16d3449..eebc750 100644 --- a/final/app/profil.php +++ b/final/app/profil.php @@ -3,20 +3,37 @@ require('include/ludo/session_verify.inc.php'); require_once('include/ludo/html_elements.inc.php'); require_once('include/connect.inc.php'); require_once('include/ju.inc.php'); +require_once('include/je.inc.php'); +require_once('include/tools.inc.php'); if ( isset($_REQUEST['action']) ) { + if ($_POST['action'] == "maj_profil") { - if (1==1)//Verification auth puis traitement + include('auth_dialog.php'); + if ( authentification(addslashes_if_needed($_POST['loginP']),addslashes_if_needed($_POST['pass']),addslashes_if_needed($_POST['methodeAuth'])) === true ) { $nom_func = 'traiter_formulaire_' . $_REQUEST['action']; - $nom_func(); + $result_fonc = $nom_func(); + } + else + { + $result_fonc = -1; } } } +if (isset($_POST['pre_action']) ) +{ + if (($_POST['pre_action'] == "verif_profil" & ($_POST["oldLogin"] == $_POST["loginP"]) | ($_POST["oldMethodeAuth"] == $_POST["methodeAuth"]))) + { + $nom_func = 'traiter_formulaire_maj_profil'; + $result_fonc = $nom_func(); + } +} generate_html_doctype_and_head("Administration du profil"); echo "<body>\n"; + generate_html_divs_menu(); ?> <div id="sous_menu"> @@ -37,29 +54,42 @@ else { $nom = $_SESSION['session_loginP']; } -if (isset($_POST['pre_action']) & $_POST['pre_action']=="verif_profil") +$verif_auth = false; +if (isset($_POST['pre_action']) ) { - + if ($_POST['pre_action']=="verif_profil" & ($_POST["oldLogin"] != $_POST["loginP"]) | ($_POST["oldMethodeAuth"] != $_POST["methodeAuth"])) + { + echo "<form method=\"post\" action=\"profil.php\" >\n"; echo "<table><tr><th>Confirmer votre authentification</th></tr>"; - echo "<tr><td>Identifiant : ".$_POST['loginP']."</td></tr>"; + echo "<tr><td>Identifiant : ".stripslashes_if_needed($_POST['loginP'])."</td></tr>"; echo "<tr><td>Mot de passe : <input name=\"pass\" type=\"password\" size=\"20\" /></td></tr>"; echo "<tr><td><input type=\"submit\" /></td></tr>"; echo "</table>"; - echo "<input type=\"hidden\" name=\"loginP\" value=\"".$_POST['loginP']."\"/>\n"; - echo "<input type=\"hidden\" name=\"courrielP\" value=\"".$_POST['courrielP']."\"/>\n"; - echo "<input type=\"hidden\" name=\"nomP\" value=\"".$_POST['nomP']."\"/>\n"; - echo "<input type=\"hidden\" name=\"methodeAuth\" value=\"".$_POST['methodeAuth']."\"/>\n"; - echo "<input type=\"hidden\" name=\"prenomP\" value=\"".$_POST['prenomP']."\"/>\n"; + echo "<input type=\"hidden\" name=\"loginP\" value=\"".stripslashes_if_needed($_POST['loginP'])."\"/>\n"; + echo "<input type=\"hidden\" name=\"courrielP\" value=\"".stripslashes_if_needed($_POST['courrielP'])."\"/>\n"; + echo "<input type=\"hidden\" name=\"nomP\" value=\"".stripslashes_if_needed($_POST['nomP'])."\"/>\n"; + echo "<input type=\"hidden\" name=\"methodeAuth\" value=\"".stripslashes_if_needed($_POST['methodeAuth'])."\"/>\n"; + echo "<input type=\"hidden\" name=\"prenomP\" value=\"".stripslashes_if_needed($_POST['prenomP'])."\"/>\n"; echo "<input type=\"hidden\" name=\"action\" value=\"maj_profil\" />\n"; echo "</form>\n"; + $verif_auth=true; + } } -else +if ($verif_auth==false) { $resultat = mysql_query("SELECT * FROM AWOR_Personne WHERE idP = '".$_SESSION['session_idP']."'"); if($resultat != false) { + if (isset($result_fonc)) + { + if ($result_fonc === true) echo "Les modifications ont été prises en compte."; + if ($result_fonc === false) echo "Erreur de modification de votre compte."; + if ($result_fonc === -1) echo "Erreur, le mot de passe et le login ne sont pas conformes."; + echo "<br/><br/>\n"; + + } $p = mysql_fetch_array($resultat); echo "<form method=\"post\" action=\"profil.php\" onSubmit=\"return verifProfil()\" >\n"; echo "<table summary=\"Formulaire permettant de modifier le profil de l'utilisateur\" >\n"; @@ -71,9 +101,13 @@ else echo "<tr><td>Votre adresse mail :</td><td><input type=\"text\" name=\"courrielP\" id=\"courrielP\" value=\"".htmlentities($p["courrielP"], ENT_QUOTES)."\"/></td></tr>\n"; echo "<tr><td>Votre nom :</td><td><input type=\"text\" name=\"nomP\" id=\"nomP\" value=\"".htmlentities($p["nomP"], ENT_QUOTES)."\"/></td></tr>\n"; echo "<tr><td>Votre prenom :</td><td><input type=\"text\" name=\"prenomP\" id=\"prenomP\" value=\"".htmlentities($p["prenomP"], ENT_QUOTES)."\"/></td></tr>\n"; + echo "<tr><td>Votre choix d'apparence :</td><td>";generate_html_div_css_chooser();echo"</td></tr>\n"; echo "<tr><td colspan=\"2\"><input type=\"submit\" /></td></tr>\n"; echo "</table>\n"; + echo "<input type=\"hidden\" name=\"oldMethodeAuth\" value=\"".$p["methodeAuth"]."\" />\n"; + echo "<input type=\"hidden\" name=\"oldLogin\" value=\"".$p["loginP"]."\" />\n"; echo "<input type=\"hidden\" name=\"pre_action\" value=\"verif_profil\" />\n"; + echo "</form>\n"; echo "</div>\n"; } |