v_fifo_agent_logout.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. Copyright (C) 2010
  17. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. require_once "root.php";
  22. require_once "includes/require.php";
  23. require_once "includes/checkauth.php";
  24. if (if_group("agent") || if_group("admin") || if_group("superadmin")) {
  25. //access granted
  26. }
  27. else {
  28. echo "access denied";
  29. exit;
  30. }
  31. //agent logout
  32. $sql = "";
  33. $sql .= "delete from v_fifo_agents ";
  34. $sql .= "where agent_username = '".$_SESSION["username"]."' ";
  35. $prep_statement = $db->prepare(check_sql($sql));
  36. $prep_statement->execute();
  37. unset($sql);
  38. //agent status log login
  39. $agent_status = '0'; //login
  40. $sql = "insert into v_fifo_agent_status_logs ";
  41. $sql .= "(";
  42. $sql .= "domain_uuid, ";
  43. $sql .= "username, ";
  44. $sql .= "agent_status, ";
  45. $sql .= "add_date ";
  46. $sql .= ")";
  47. $sql .= "values ";
  48. $sql .= "(";
  49. $sql .= "'$domain_uuid', ";
  50. $sql .= "'".$_SESSION["username"]."', ";
  51. $sql .= "'$agent_status', ";
  52. $sql .= "now() ";
  53. $sql .= ")";
  54. $db->exec(check_sql($sql));
  55. unset($sql);
  56. //redirect
  57. require_once "includes/header.php";
  58. echo "<meta http-equiv=\"refresh\" content=\"2;url=v_fifo_agent_edit.php\">\n";
  59. echo "<div align='center'>\n";
  60. echo "Logout Complete\n";
  61. echo "</div>\n";
  62. require_once "includes/footer.php";
  63. return;
  64. ?>