Simple PHP api for SnipeIT app. Not maintained anymore; check out BinStack instead: https://source.netsyms.com/Business/BinStack and https://netsyms.biz/binstack
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.

29 lines
596 B

  1. <?php
  2. /**
  3. * Get all the models.
  4. */
  5. require 'required.php';
  6. //require 'dieifnotloggedin.php';
  7. $from = $_GET['from'];
  8. require 'readfrom.php';
  9. $id = $_GET['id'];
  10. if (is_empty($id) || $id == 0 || $id == null) {
  11. $model = '0';
  12. } else {
  13. if ($from == 'assets') {
  14. $model = $database->select($from, 'model_id', ['id' => $id])[0];
  15. } else {
  16. sendError("Command only valid for assets.");
  17. }
  18. if ($model == null) {
  19. $model = 0;
  20. }
  21. }
  22. $list = $database->select('models', ['id', 'name']);
  23. die(json_encode(['status' => 'OK', 'model' => $model, 'list' => $list]));