upload.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /*
  3. *
  4. * Application Name: PHP Custom Content Uploader
  5. * Module Name: upload.php
  6. *
  7. * Copyright (c) 2020 DBMXPCA Technologies. All rights reserved.
  8. * https://www.dbmxpca.com/
  9. *
  10. */
  11. require_once($_SERVER['DOCUMENT_ROOT'] . "/core.php");
  12. /*
  13. *
  14. * This script is designed to be called with the following parameters:
  15. *
  16. * Parameter Description
  17. * -----------------------------------------------------------------
  18. * u Username, corresponding to the user's name in the "users.json" file. Value may not be empty. Case-sensitive.
  19. * k API Key, corresponding to the user's "key" value in the "users.json" file. Value may not be empty. Not case-sensitive by default but can be changed in "config.php".
  20. *
  21. */
  22. // Check user authorization.
  23. $err = null;
  24. if (CHECK_USER($err)){
  25. // Check image prelim data.
  26. $err = null;
  27. if (CHECK_IMAGE_PRELIM_DATA($err)){
  28. $err = null;
  29. if (CHECK_IMAGE_ERRORS($err)){
  30. // Attempt to create user's directory within UCD.
  31. if (CREATE_USER_CONTENT_DIR($_REQUEST['u'])){
  32. echo "ok";
  33. }
  34. else{
  35. $err = "500_1";
  36. DIE_ERR($err);
  37. }
  38. }
  39. else{
  40. DIE_ERR($err);
  41. }
  42. }
  43. else{
  44. DIE_ERR($err);
  45. }
  46. }
  47. else{
  48. DIE_ERR($err);
  49. }