recupfgm.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. require dirname(__FILE__).'/../inc/prepend.php';
  3. $con = new connection(DB_USER,DB_PASS,DB_HOST,DB_DBASE);
  4. $blog = new blog($con,DB_PREFIX,NULL,dc_encoding);
  5. $rsUser = $blog->getUser();
  6. $message = '';
  7. $adminList = '';
  8. while(!$rsUser->EOF())
  9. {
  10. if ($rsUser->field('user_level') == 9)
  11. $adminList.='<option>'.$rsUser->field('user_id').'</option>';
  12. $rsUser->moveNext();
  13. }
  14. if (isset($_POST['user']))
  15. {
  16. $updReq = 'UPDATE '.$blog->t_user.' SET user_pwd = \''.md5($blog->con->escapeStr(trim($_POST['newpwd']))).'\'';
  17. $updReq.= 'WHERE user_id=\''.$_POST['user'].'\'';
  18. if($blog->con->execute($updReq))
  19. $message = "Mot de passe mis à jour. Il est conseillé de supprimer le fichier ".__FILE__.".";
  20. else
  21. $message = "Erreur lors de la modification du mot de passe.";
  22. }
  23. ?>
  24. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  25. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  26. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
  27. <head>
  28. <meta http-equiv="Content-Type" content="text/HTML; charset=iso-8859-15" />
  29. <meta http-equiv="Content-Script-Type" content="text/javascript" />
  30. <meta http-equiv="Content-Style-Type" content="text/css" />
  31. <meta http-equiv="Content-Language" content="fr" />
  32. <title>Récupération de mot de passe pour Dotclear</title>
  33. </head>
  34. <body>
  35. <p><strong><?php echo $message; ?></strong></p>
  36. <form action="" method="post">
  37. <fieldset>
  38. <legend>Liste des administrateurs</legend>
  39. <label for="admin">Utilisateurs administrateurs</label>
  40. <select name="user" id="user">
  41. <?php echo $adminList; ?>
  42. </select>
  43. <label for="newpwd" id="newpwd">Nouveau mot de passe</label>
  44. <input type="text" value="" name="newpwd" id="newpwd" />
  45. <input type="submit" value="Utiliser comme nouveau mot de passe" />
  46. </fieldset>
  47. </form>
  48. </body>
  49. </html>