Guest User

Untitled

a guest
Feb 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. <?php
  2.  
  3. header('Content-type: text/plain');
  4.  
  5. foreach (array('index', 'mcp', 'ucp', 'config', 'adm/index') as $file)
  6. {
  7. if (!file_exists("./$file.php"))
  8. {
  9. die(sprintf('Sure this is in your phpBB directory? "%s" is missing', $file));
  10. }
  11. }
  12.  
  13. $test_file = './cache/phpbb_chmod_debug.test';
  14.  
  15. touch($test_file);
  16.  
  17. $code = array(
  18. "php_uname()",
  19. "function_exists('fileowner')",
  20. "function_exists('filegroup')",
  21. "function_exists('posix_getuid')",
  22. "function_exists('posix_getgroups')",
  23. "function_exists('posix_getpwuid')",
  24. "function_exists('posix_getgrgid')",
  25. );
  26.  
  27. if (function_exists('fileowner'))
  28. {
  29. $code = array_merge($code, array(
  30. "fileowner('./common.php')",
  31. "fileowner('$test_file')",
  32. ));
  33. }
  34.  
  35. if (function_exists('filegroup'))
  36. {
  37. $code = array_merge($code, array(
  38. "filegroup('./common.php')",
  39. "filegroup('$test_file')",
  40. ));
  41. }
  42.  
  43. if (function_exists('posix_getuid'))
  44. {
  45. $code = array_merge($code, array(
  46. "posix_getuid()",
  47. ));
  48. }
  49.  
  50. if (function_exists('posix_getgroups'))
  51. {
  52. $code = array_merge($code, array(
  53. "posix_getgroups()",
  54. ));
  55. }
  56.  
  57. if (function_exists('posix_getuid') && function_exists('posix_getpwuid'))
  58. {
  59. $code = array_merge($code, array(
  60. "posix_getpwuid(posix_getuid())",
  61. ));
  62. }
  63.  
  64. if (function_exists('posix_getgroups') && function_exists('posix_getgrgid'))
  65. {
  66. $code = array_merge($code, array(
  67. "array_map('posix_getgrgid', posix_getgroups())",
  68. ));
  69. }
  70.  
  71. foreach ($code as $line)
  72. {
  73. echo sprintf("`%1\$s` yeilds:\n%2\$s\n\n", $line, eval(sprintf('return var_export(%s, true);', $line)));
  74. }
  75.  
  76. unlink($test_file);
Add Comment
Please, Sign In to add comment