/mods/_core/users/master_list_delete.php

https://github.com/radiocontrolled/ATutor · PHP · 49 lines · 32 code · 5 blank · 12 comment · 5 complexity · afe46530c9a7bc534ff78d5e9cdf08b6 MD5 · raw file

  1. <?php
  2. /****************************************************************************/
  3. /* ATutor */
  4. /****************************************************************************/
  5. /* Copyright (c) 2002-2010 */
  6. /* Inclusive Design Institute */
  7. /* http://atutor.ca */
  8. /* */
  9. /* This program is free software. You can redistribute it and/or */
  10. /* modify it under the terms of the GNU General Public License */
  11. /* as published by the Free Software Foundation. */
  12. /****************************************************************************/
  13. // $Id$
  14. define('AT_INCLUDE_PATH', '../../../include/');
  15. require(AT_INCLUDE_PATH.'vitals.inc.php');
  16. admin_authenticate(AT_ADMIN_PRIV_USERS);
  17. if (isset($_POST['submit_no'])) {
  18. $msg->addFeedback('CANCELLED');
  19. header('Location: '.AT_BASE_HREF.'mods/_core/users/master_list.php');
  20. exit;
  21. } else if (isset($_POST['submit_yes'])) {
  22. $_POST['id'] = $addslashes($_POST['id']);
  23. $sql = "DELETE FROM ".TABLE_PREFIX."master_list WHERE public_field='$_POST[id]'";
  24. $result = mysql_query($sql, $db);
  25. write_to_log(AT_ADMIN_LOG_DELETE, 'master_list', mysql_affected_rows($db), $sql);
  26. $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
  27. header('Location: '.AT_BASE_HREF.'mods/_core/users/master_list.php');
  28. exit;
  29. }
  30. require(AT_INCLUDE_PATH.'header.inc.php'); ?>
  31. <?php
  32. $_GET['id'] = $addslashes($_GET['id']);
  33. $sql = "SELECT * FROM ".TABLE_PREFIX."master_list WHERE public_field='$_GET[id]'";
  34. $result = mysql_query($sql, $db);
  35. if (!($row = mysql_fetch_assoc($result))) {
  36. echo _AT('no_user_found');
  37. } else {
  38. $hidden_vars['id'] = $_GET['id'];
  39. $confirm = array('LIST_DELETE', $_GET['id']);
  40. $msg->addConfirm($confirm, $hidden_vars);
  41. $msg->printConfirm();
  42. }
  43. ?>
  44. <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>