An easy point of sale system with automatic inventory tracking. https://netsyms.biz/apps/nickelbox/
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

api.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. * Simple JSON API to allow other apps to access data from this app.
  7. *
  8. * Requests can be sent via either GET or POST requests. POST is recommended
  9. * as it has a lower chance of being logged on the server, exposing unencrypted
  10. * user passwords.
  11. */
  12. require __DIR__ . '/required.php';
  13. require_once __DIR__ . '/lib/login.php';
  14. require_once __DIR__ . '/lib/userinfo.php';
  15. header("Content-Type: application/json");
  16. $username = $VARS['username'];
  17. $password = $VARS['password'];
  18. if (user_exists($username) !== true || authenticate_user($username, $password, $errmsg) !== true) {
  19. header("HTTP/1.1 403 Unauthorized");
  20. die("\"403 Unauthorized\"");
  21. }
  22. $userinfo = getUserByUsername($username);
  23. // query max results
  24. $max = 20;
  25. if (preg_match("/^[0-9]+$/", $VARS['max']) === 1 && $VARS['max'] <= 1000) {
  26. $max = (int) $VARS['max'];
  27. }
  28. switch ($VARS['action']) {
  29. case "ping":
  30. $out = ["status" => "OK", "maxresults" => $max, "pong" => true];
  31. exit(json_encode($out));
  32. default:
  33. header("HTTP/1.1 400 Bad Request");
  34. die("\"400 Bad Request\"");
  35. }