summaryrefslogtreecommitdiff
path: root/final/app/profil.php
blob: eebc750f9adaac3893c069bbe57da37fdf46239b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
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")
	{
		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'];
			$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">
		<p class="arbre">
		&gt; <a href="index.php">Accueil</a>
		&gt; Administration du profil
		</p>
	</div>
<?php
generate_html_div_help();
echo "<div id=\"contenu\">\n";
$idP = $_SESSION['session_idP'];
if ( isset( $_SESSION['session_prenomP'] ) && isset( $_SESSION['session_prenomP'] ) )
{ 
	$nom=$_SESSION['session_prenomP'] . ' ' . $_SESSION['session_nomP'];
}
else
{
	$nom = $_SESSION['session_loginP']; 
}
$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 : ".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=\"".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;
	}
}
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 &eacute;t&eacute; 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";
		echo "<tr><td>Methode d'authentification : </td><td>\n<select name=\"methodeAuth\">\n";
		if($p["methodeAuth"] == "webetud") echo "<option value=\"webetud\" selected=\"selected\">Webetud</option>\n"; else echo "<option value=\"webetud\">Webetud</option>\n";
		if($p["methodeAuth"] == "pop") echo "<option value=\"pop\" selected=\"selected\">POP3</option>\n"; else echo "<option value=\"pop\">POP3</option>\n";
		echo "</select></td></tr>\n";
		echo "<tr><td>Votre login :</td><td><input type=\"text\" name=\"loginP\" id=\"loginP\" value=\"".htmlentities($p["loginP"], ENT_QUOTES)."\"/></td></tr>\n";
		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";
	}
	if ( isset ($errmsg) ) generate_html_div_errmsg($errmsg);
}
?>
<div id="msg"></div>
<?php generate_html_div_footer() ?> 
</body>
</html>