v_fifo_agent_profiles_delete.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <[email protected]>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2012
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. require_once "root.php";
  22. require_once "resources/require.php";
  23. require_once "resources/check_auth.php";
  24. if (if_group("admin") || if_group("superadmin")) {
  25. //access granted
  26. }
  27. else {
  28. echo "access denied";
  29. exit;
  30. }
  31. if (count($_GET)>0) {
  32. $id = check_str($_GET["id"]);
  33. }
  34. if (strlen($id)>0) {
  35. //delete child data
  36. $sql = "";
  37. $sql .= "delete from v_fifo_agent_profile_members ";
  38. $sql .= "where domain_uuid = '$domain_uuid' ";
  39. $sql .= "and fifo_agent_profile_id = '$id' ";
  40. $prep_statement = $db->prepare(check_sql($sql));
  41. $prep_statement->execute();
  42. unset($sql, $prep_statement);
  43. //delete parent data
  44. $sql = "";
  45. $sql .= "delete from v_fifo_agent_profiles ";
  46. $sql .= "where domain_uuid = '$domain_uuid' ";
  47. $sql .= "and fifo_agent_profile_id = '$id' ";
  48. $prep_statement = $db->prepare(check_sql($sql));
  49. $prep_statement->execute();
  50. unset($sql, $prep_statement);
  51. }
  52. require_once "resources/header.php";
  53. echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fifo_agent_profiles.php\">\n";
  54. echo "<div align='center'>\n";
  55. echo "Delete Complete\n";
  56. echo "</div>\n";
  57. require_once "resources/footer.php";
  58. return;
  59. ?>