OnChange 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/local/bin/php
  2. <?php if ( !empty($argv) && $argc == 5 ) {
  3. // Environment:
  4. define('ENVIRONMENT', basename($argv[0]));
  5. // User's login:
  6. if (isset($argv[1])) {
  7. define('LOGIN', $argv[1]);
  8. } else define('LOGIN', NULL);
  9. // Changed parameter:
  10. if (isset($argv[2])) {
  11. define('PARAMETER', $argv[2]);
  12. } else define('PARAMETER', NULL);
  13. // Old value:
  14. if (isset($argv[3])) {
  15. define('OLD_VALUE', $argv[3]);
  16. } else define('OLD_VALUE', NULL);
  17. // New value:
  18. if (isset($argv[4])) {
  19. define('NEW_VALUE', $argv[4]);
  20. } else define('NEW_VALUE', NULL);
  21. // Paths:
  22. define('BASEPATH', __DIR__ . '/');
  23. define('SYSTEM', BASEPATH . 'system/');
  24. define('DBPATH', SYSTEM . 'database/');
  25. define('NASPATH', SYSTEM . 'executer/');
  26. define('LOGPATH', SYSTEM . 'log/');
  27. // Driver's extention:
  28. define('EXT', '.drv');
  29. // Turn off PHP error reporting:
  30. error_reporting(0);
  31. // Unset all resived arguments and their amount:
  32. unset($argv, $argc);
  33. // If changing parameter is `IP`:
  34. if ( PARAMETER == 'IP' && OLD_VALUE != '*' && NEW_VALUE != '*') {
  35. // Put old IP address to `IP` constant:
  36. define('IP', OLD_VALUE);
  37. // Continue...
  38. include_once(SYSTEM . 'ubilling.cls');
  39. new Ubilling();
  40. }
  41. } else exit('Only STG can run script!');
  42. ?>