QwikClock is an employee time tracking app.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

action.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /**
  6. * Make things happen when buttons are pressed and forms submitted.
  7. */
  8. require_once __DIR__ . "/required.php";
  9. if ($VARS['action'] !== "signout") {
  10. dieifnotloggedin();
  11. }
  12. /**
  13. * Redirects back to the page ID in $_POST/$_GET['source'] with the given message ID.
  14. * The message will be displayed by the app.
  15. * @param string $msg message ID (see lang/messages.php)
  16. * @param string $arg If set, replaces "{arg}" in the message string when displayed to the user.
  17. */
  18. function returnToSender($msg, $arg = "") {
  19. global $VARS;
  20. if ($arg == "") {
  21. header("Location: app.php?page=" . urlencode($VARS['source']) . "&msg=" . $msg);
  22. } else {
  23. header("Location: app.php?page=" . urlencode($VARS['source']) . "&msg=$msg&arg=$arg");
  24. }
  25. die();
  26. }
  27. switch ($VARS['action']) {
  28. case "signout":
  29. session_destroy();
  30. header('Location: index.php');
  31. die("Logged out.");
  32. }