OnConnect 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/local/bin/php
  2. <?php if ( !empty($argv) && $argc == 6 ) {
  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. // User's IP:
  10. if ( isset($argv[2]) ) {
  11. define('IP', $argv[2]);
  12. } else define('IP', NULL);
  13. // User's cash:
  14. if ( isset($argv[3]) ) {
  15. define('CASH', $argv[3]);
  16. } else define('CASH', NULL);
  17. // User's ID:
  18. if ( isset($argv[4]) ) {
  19. define('ID', $argv[4]);
  20. } else define('ID', NULL);
  21. // User's allowed directions:
  22. if ( isset($argv[5]) ) {
  23. define('DIRS', $argv[5]);
  24. } else define('DIRS', NULL);
  25. // Paths:
  26. define('BASEPATH', __DIR__ . '/');
  27. define('SYSTEM', BASEPATH . 'system/');
  28. define('DBPATH', SYSTEM . 'database/');
  29. define('NASPATH', SYSTEM . 'executer/');
  30. define('LOGPATH', SYSTEM . 'log/');
  31. // Driver's extention:
  32. define('EXT', '.drv');
  33. // Turn off PHP error reporting:
  34. error_reporting(0);
  35. // Unset all resived arguments and their amount:
  36. unset($argv, $argc);
  37. // Continue...
  38. include_once(SYSTEM . 'ubilling.cls');
  39. new Ubilling();
  40. } else exit('Only STG can run script!');
  41. ?>