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.

response.php 625B

123456789101112131415161718192021222324252627
  1. <?php
  2. function sendOK($message = "", $die = false) {
  3. if (!is_empty($message) && JSON) {
  4. echo '{ "status": "OK", "message": "'.$message.'" }';
  5. } elseif (is_empty($message) && JSON) {
  6. echo '{ "status": "OK" }';
  7. } elseif (!is_empty($message) && !JSON) {
  8. echo "OK:$message";
  9. } else {
  10. echo "OK";
  11. }
  12. if ($die) {
  13. die();
  14. }
  15. }
  16. function sendError($error, $die = false) {
  17. if (JSON) {
  18. echo '{ "status": "ERROR", "message": "' . $error . '" }';
  19. } else {
  20. echo "Error: $error";
  21. }
  22. if ($die) {
  23. die();
  24. }
  25. }