PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/__motdepasse.php

https://bitbucket.org/mw4rf/ajpsc-annuaire
PHP | 81 lines | 45 code | 16 blank | 20 comment | 2 complexity | 74ed0a40c069b04849fe3b9cb953e3fb MD5 | raw file
  1. <?php
  2. // Annuaire Alumnii
  3. // Base de données et annuaire d'anciens étudiants.
  4. // Copyright (C) <2006> <Guillaume Florimond>
  5. // This program is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. include("../includes/config.inc.php");
  16. ?>
  17. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  18. <html lang="en">
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  21. <title>AJPSC Annuaire - Modification du mot de passe</title>
  22. <meta name="author" content="Guillaume Florimond">
  23. <!-- Date: 2006-12-08 -->
  24. </head>
  25. <body>
  26. <?php
  27. /* Se connecter à la bdd et effectuer les changements voulus */
  28. if($_GET["action"] == "changer") {
  29. /* Récupération du contenu du formulaire */
  30. $pass = $_POST['pass'];
  31. /* Chiffrement du mot de passe */
  32. $pass = sha1($pass);
  33. /* Connexion à la base de données */
  34. $db = mysql_connect($_config['host'], $_config['user'], $_config['passwd']);
  35. mysql_select_db($_config['base'],$db);
  36. /* Construction de la requête SQL */
  37. $sql = "UPDATE admin SET pass='$pass' WHERE id='1';";
  38. /* Exécution de la requête */
  39. $req = mysql_query($sql) or die("Erreur");
  40. /* Affichage d'un message pour dire que tout s'est bien passé */
  41. echo "Modification effectu&eacute;e.";
  42. }
  43. else
  44. {
  45. ?>
  46. <form id="mdp" name="mdp" method="post" action="motdepasse.php?action=changer">
  47. <table width="45%" border="0" align="center" cellpadding="2" cellspacing="2">
  48. <tr>
  49. <td>Nouveau mot de passe: </td>
  50. <td><input type="input" name="pass" /></td>
  51. </tr>
  52. <tr>
  53. <td colspan="2"><label>
  54. <div align="center">
  55. <input type="submit" name="Submit" value="Envoyer" />
  56. </div>
  57. </label></td>
  58. </tr>
  59. </table>
  60. </form>
  61. <?php
  62. }
  63. ?>
  64. </body>
  65. </html>