Location: PHPKode > projects > EmploiNet : a timetable web manager > EmploiNet/v0.8.0/Administration/mot_de_passe.php3
<?
	include("../BarreDeMenu.php3");
    include("../Session/security.php");
// Entete
    buildHeader("Mot de passe");
// Verification de la session
	$autorisation_list[0]=0; // Administrateur
	$autorisation_list[1]=1; // Professeur
	$autorisation_list[2]=2; // Etudiant
	$autorisation_list[3]=3; // Gestionnaire
	$autorisation_list[4]=4; // Directeur de departement
	$user_type = validateSession($id_session);
	if ($user_type == -1 || !security($id_session,$autorisation_list)) print("Accès refusé");
    else
    {
// Barre de menu
		buildMenuBar($id_session,$user_type,"mot_de_passe.php3",false);
// Ouverture de la connexion avec la base de donnees
	    $connection = openConnection($databaseName);
// Traitement du changement de mot de passe
		if ($choice == 1)
		{
			$databas= mysql_select_db("session");
			$result = mysql_query("SELECT login FROM session WHERE id_session='$id_session'");
			$a_record = mysql_fetch_array($result);
			$result = mysql_query("SELECT password,login FROM user WHERE login='".$a_record["login"]."'");
			$a_record = mysql_fetch_array($result);
			if ($a_record["password"] == $old_password)
			{
				if ($new_password == $new_password2) 
				{
					mysql_query("UPDATE user SET password='$new_password' WHERE login='".$a_record["login"]."'");
					print("<CENTER>Votre mot de passe a &eacute;t&eacute; correctement chang&eacute;.</CENTER><BR>");
				}
				else print("<CENTER>Les deux mots de passe saisis ne sont pas identiques.</CENTER><BR>\n");
			}
			else print("<CENTER>L'ancien mot de passe est erron&eacute;.</CENTER><BR>");
			$databas= mysql_select_db($databaseName);		
		}
		else
		{		
			print("<FORM METHOD=\"POST\" ACTION=\"mot_de_passe.php3\">\n");
		    print("  <input type=\"hidden\" name=\"choice\" value=\"-1\">\n");
		    print("  <input type=\"hidden\" name=\"id_session\" value=\"$id_session\">\n");
		    print("  <input type=\"hidden\" name=\"user_type\" value=\"$user_type\">\n");
		    print("  <input type=\"hidden\" name=\"user_id\" value=\"$user_id\">\n");
		    print("  <input type=\"hidden\" name=\"display\" value=\"$display\">\n");
			print("<TABLE align=\"center\">\n");
			print("<tr>\n");
			print("<td>Ancien password : </td><td><INPUT TYPE=password NAME=\"old_password\"></td>\n");
			print("</tr>\n");
			print("<tr>\n");



			print("<td>Nouveau password : </td><td><INPUT TYPE=password NAME=\"new_password\"></td>\n");



			print("</tr>\n");



			print("<tr>\n");



			print("<td>Nouveau password (confirmation) : </td><td><INPUT TYPE=password NAME=\"new_password2\"></td>\n");



			print("</tr>\n");



			print("<tr>\n");



			print("<td colspan=2 align=\"center\"><INPUT TYPE=\"submit\" VALUE=\"Envoyer\" OnClick=\"choice.value=1; submit()\"></td>\n");



			print("</tr>\n");



			print("</TABLE>\n");



			print("</FORM>\n");



		}



	}



	buildEndOfPage();



?>
Return current item: EmploiNet : a timetable web manager