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
| <?php
session_start();
include_once 'recup_config.php'; //On récupère la configuration du script
$titre_page = MOD_PROFIL_TITRE; //Définition du titre de la page
include_once 'verifications.php'; //On inclue les vérifications
if( isset($_POST['envoi']) ) {
require_once 'fonctions/formulaires.php';
$_POST = form_secu($_POST, 'addslashes');
$_POST = form_secu($_POST, 'trim');
if( strlen($_POST['email']) < 1)
$erreur .=MOD_PROFIL_PAS_EMAIL."<br />";
if( strlen($_POST['adresse']) < 1)
$erreur .=MOD_PROFIL_PAS_EMAIL."<br />";
if( strlen($_POST['ville']) < 1)
$erreur .=MOD_PROFIL_PAS_EMAIL."<br />";
if( strlen($_POST['codepostal']) < 1)
$erreur .=MOD_PROFIL_PAS_EMAIL."<br />";
connexion();
if( strlen($_POST['passe_enc']) > 1)
{
if($_POST['nouv_passe'] != $_POST['nouv_passe2'])
$erreur .=MOD_PROFIL_MDPS_CORRES."<br />";
if( strlen($_POST['nouv_passe']) < 5)
$erreur .=MOD_PROFIL_MDP_PETIT."<br />";
$_POST['passe_enc'] = md5($_POST['passe_enc']); //Encodage en md5
$reponse_passe=mysql_query("SELECT passe FROM ". PREFIX ."membres WHERE passe='". $_POST['passe_enc'] ."' AND identifiant='". $session ."'") or die ('Erreur, impossible de vérifier si l\'ancien mot de passe est correct.'); //verification si mdp valide
$count_passe=mysql_num_rows($reponse_passe);
if($count_passe === 0)
$erreur .=MOD_PROFIL_MDP_CORRES."<br />";
if( strlen($erreur) > 5 )
{
echo $erreur ,'<a href="#" onClick="history.back()">', GENERAL_RETOUR, '</a>';
include_once 'bas.php';
exit;
}
$_POST['nouv_passe'] = md5($_POST['nouv_passe']);
mysql_query("UPDATE ". PREFIX ."membres SET passe='". $_POST['nouv_passe'] ."' WHERE identifiant='". $session ."'") or die ('Erreur, modification du mot de passe impossible');
}
mysql_query("UPDATE ". PREFIX ."membres SET email='". $_POST['email'] ."' WHERE identifiant='". $session ."'") or die ('Erreur, modification de l\'e-mail impossible');
mysql_query("UPDATE ". PREFIX ."membres SET adresse='". $_POST['adresse'] ."' WHERE identifiant='". $session ."'") or die ('Erreur, modification de l\'adresse impossible');
mysql_query("UPDATE ". PREFIX ."membres SET ville='". $_POST['ville'] ."' WHERE identifiant='". $session ."'") or die ('Erreur, modification de la ville impossible');
mysql_query("UPDATE ". PREFIX ."membres SET codepostal='". $_POST['codepostal'] ."' WHERE identifiant='". $session ."'") or die ('Erreur, modification du code posal impossible');
echo'<div align="center">', MOD_PROFIL_FORM_OK, '<br />
<a href="espacemembre.php">', GENERAL_RETOUR, '</a></div>';
mysql_close();
}
else {
?><div align="center"><h1><?php echo MOD_PROFIL_TITRE; ?></h1>
<form action="" method="post">
<table class="inscription">
<tr>
<td><label for="email"><?php echo MOD_PROFIL_EMAIL; ?></label></td>
<td><input name="email" type="text" id="email" value="<?php echo $email ?>"></td>
</tr>
<tr>
<td><label for="adresse">Adresse</label></td>
<td><input name="adresse" type="text" id="adresse" value="<?php echo $adresse ?>"></td>
</tr>
<tr>
<td><label for="ville">Ville</label></td>
<td><input name="ville" type="text" id="ville" value="<?php echo $ville ?>"></td>
</tr>
<tr>
<td><label for="codepostal">Code Postal</label></td>
<td><input name="codepostal" type="text" id="codepostal" value="<?php echo $codepostal ?>"></td>
</tr>
<tr>
<td><label for="mdp"><?php echo MOD_PROFIL_ANCIEN_PASS; ?></label></td>
<td><input name="passe_enc" type="password" id="mdp"></td>
</tr>
<tr>
<td><label for="mdp2"><?php echo MOD_PROFIL_NOUVEAU_MDP; ?></label></td>
<td><input name="nouv_passe" type="password" id="mdp2"></td>
</tr>
<tr>
<td><label for="mdp3"><?php echo MOD_PROFIL_CONFIRM_MDP; ?></label></td>
<td><input name="nouv_passe2" type="password" id="mdp3"></td>
</tr>
<tr>
<td colspan="2"><div align=center><input type="submit" name="envoi" value="<?php echo MOD_PROFIL_ENVOYER; ?>"></div></td>
</tr>
</table>
</form><br />
<a href="espacemembre.php"><?php echo GENERAL_RETOUR; ?></a></div>
<?php
}
?> |
Partager