PageRenderTime 40ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/admin/__supprimer.php

https://bitbucket.org/mw4rf/ajpsc-annuaire
PHP | 75 lines | 44 code | 14 blank | 17 comment | 2 complexity | bb76c8af1f157e8c276a54759ce9bfd1 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 - Supprimer une fiche</title>
  22. <meta name="author" content="Guillaume Florimond">
  23. <!-- Date: 2006-12-21 -->
  24. </head>
  25. <body>
  26. <?php
  27. /* Se connecter à la bdd et effectuer les changements voulus */
  28. if($_GET["action"] == "supprimer") {
  29. /* Récupération du contenu du formulaire */
  30. $id = $_POST['id'];
  31. /* Connexion à la base de données */
  32. $db = mysql_connect($_config['host'], $_config['user'], $_config['passwd']);
  33. mysql_select_db($_config['base'],$db);
  34. $sql = "DELETE FROM utilisateur WHERE id=$id;";
  35. mysql_query($sql) or die('Erreur');
  36. /* Affichage d'un message pour dire que tout s'est bien passé */
  37. echo "Fiche supprimée.";
  38. }
  39. else
  40. {
  41. ?>
  42. <form name="supprimer" method="post" action="supprimer.php?action=supprimer">
  43. <table width="45%" border="0" align="center" cellpadding="2" cellspacing="2">
  44. <tr>
  45. <td>Numéro de la fiche à supprimer: </td>
  46. <td><input type="input" name="id" /></td>
  47. </tr>
  48. <tr>
  49. <td colspan="2"><label>
  50. <div align="center">
  51. <input type="submit" name="Submit" value="Supprimer" />
  52. </div>
  53. </label></td>
  54. </tr>
  55. </table>
  56. </form>
  57. <?php
  58. }
  59. ?>
  60. </body>
  61. </html>