🔍 Server & File Diagnostics";
// 1. فحص المجلد
$dir = __DIR__;
echo "Current Dir: $dir
";
if (is_writable($dir)) {
echo "✅ Directory is Writable (777 OK)
";
} else {
echo "❌ Directory NOT Writable! Please set Permissions to 777.
";
}
// 2. فحص ملف save_transactions.php
$target_file = $dir . '/save_transactions.php';
echo "
Testing 'save_transactions.php':
";
if (!file_exists($target_file)) {
echo "❌ File not found!";
} else {
// محاولة فحص الكود بحثاً عن أخطاء نحوية (Syntax Errors)
$content = file_get_contents($target_file);
// فحص إذا كان المستخدم نسخ علامات Markdown بالخطأ
if (strpos($content, '```') !== false) {
echo "❌ CRITICAL ERROR FOUND: Markdown tags (```) detected inside the PHP file!
";
echo "👉 Solution: Open the file and remove the first/last lines containing ``` or ```php.
";
} elseif (substr(trim($content), 0, 5) !== '❌ START ERROR: File does not start with <?php
";
echo "Found instead: " . substr(trim($content), 0, 20) . "...
";
} else {
echo "✅ File structure looks clean (No Markdown tags).
";
// محاولة استدعاء الملف (سيظهر الخطأ إذا وجد)
echo "Attempting to include file...
";
echo "";
// نحجز المخرجات لنرى إذا كان هناك خطأ
ob_start();
try {
include $target_file;
} catch (Throwable $e) {
echo "Runtime Error: " . $e->getMessage();
}
$output = ob_get_clean();
if (empty($output)) {
echo "File included successfully (No output is good in this context).";
} else {
echo "Output/Error:
" . $output;
}
echo "
";
}
}
?>