<?php
/*codeNET By: Mahdi Hamid
*/
@header('Content-type: text/html;charset=utf-8');
@date_default_timezone_set("Asia/Riyadh");
$fileplace = "uploads";
$log_folder = "files";
if(!file_exists($fileplace)) mkdir($fileplace, 0777, true);
if(!file_exists($log_folder)) mkdir($log_folder, 0777, true);
/**
* دالة السحب الاحترافية باستخدام cURL
* تعمل مع المواقع التي تمنع السحب العادي
*/
function fetchRemoteFile($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // تتبع الروابط المختصرة والمحولة
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // تخطي حماية SSL
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
// محاكاة متصفح حقيقي بالكامل
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36");
curl_setopt($ch, CURLOPT_REFERER, "https://www.google.com/");
$data = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
// التأكد أن الرد كان ناجحاً (HTTP 200)
if ($info['http_code'] == 200) {
return $data;
}
return false;
}
function watermark($name, $ext, $logo){
if (!file_exists($logo)) return false;
$src_img = null;
$ext = strtolower($ext);
if (preg_match("/jpg|jpeg/i",$ext)) $src_img = @imagecreatefromjpeg($name);
elseif (preg_match("/webp/i",$ext)) $src_img = @imagecreatefromwebp($name);
elseif (preg_match("/png/i",$ext)) $src_img = @imagecreatefrompng($name);
if (!$src_img) return false;
$src_logo = @imagecreatefrompng($logo);
if (!$src_logo) return false;
$bwidth = imagesx($src_img);
$bheight = imagesy($src_img);
$lwidth = imagesx($src_logo);
$lheight = imagesy($src_logo);
if ($bwidth > 160 && $bheight > 130) {
$src_x = $bwidth - ($lwidth + 5);
$src_y = $bheight - ($lheight + 5);
imagealphablending($src_img, true);
imagecopy($src_img, $src_logo, $src_x, $src_y, 0, 0, $lwidth, $lheight);
if (preg_match("/jpg|jpeg/i",$ext)) imagejpeg($src_img, $name, 90);
elseif (preg_match("/png/i",$ext)) imagepng($src_img, $name);
elseif (preg_match("/webp/i",$ext)) imagewebp($src_img, $name);
imagedestroy($src_img);
imagedestroy($src_logo);
}
}
function convertToReadableSize($size){
if($size <= 0) return "0 KB";
$base = log($size) / log(1024);
$suffix = array("", "KB", "MB", "GB", "TB");
return round(pow(1024, $base - floor($base)), 1) . " " . $suffix[floor($base)];
}
if($_POST){
$ip = $_SERVER['REMOTE_ADDR'];
if(file_exists("files/ip.php")) { include("files/ip.php"); $ip = isset($user_ip) ? $user_ip : $ip; }
$description = strip_tags($_POST['desc']);
$ss = date('Y-m-d H:i:s');
$site_url = 'http://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['REQUEST_URI']), '\\/') . '/';
// 1. معالجة الرفع من الجهاز
if (!empty($_FILES['image']['name'][0])) {
echo "<h3>نتائج الرفع من الجهاز:</h3>";
foreach ($_FILES['image']['name'] as $key => $val) {
if ($_FILES['image']['error'][$key] == 0) {
$ext = pathinfo($_FILES['image']['name'][$key], PATHINFO_EXTENSION);
$new_name = "up_" . time() . "_" . rand(1000, 9999) . "." . $ext;
$target = $fileplace . "/" . $new_name;
if (move_uploaded_file($_FILES['image']['tmp_name'][$key], $target)) {
@watermark($target, $ext, 'logo/logo.png');
file_put_contents("./files/datte.txt", "$description,$new_name,,$ip,$ss\n", FILE_APPEND);
echo "✅ تم رفع: <a href='".$site_url.$target."' target='_blank'>$new_name</a><br>";
}
}
}
}
// 2. معالجة السحب من الروابط (كافة المواقع)
$remote_links = array_filter([$_POST['url'], $_POST['urls']]);
if (!empty($remote_links)) {
echo "<h3>نتائج السحب من الروابط:</h3>";
foreach ($remote_links as $current_link) {
$current_link = trim($current_link);
// استخراج الامتداد
$path_info = pathinfo(parse_url($current_link, PHP_URL_PATH));
$ext = isset($path_info['extension']) ? strtolower($path_info['extension']) : 'jpg';
// منع سحب ملفات PHP
if(in_array($ext, ['php', 'php5', 'phtml', 'cgi', 'asp'])) {
$ext = !empty($_POST['ppp']) ? $_POST['ppp'] : 'txt';
}
// منع السحب من النطاق الحالي
if (stripos($current_link, $_SERVER['HTTP_HOST']) !== false) {
echo "❌ خطأ: الرابط من نفس موقعك.<br>";
continue;
}
$new_name = "fetch_" . time() . "_" . rand(1000, 9999) . "." . $ext;
$target = $fileplace . "/" . $new_name;
// تنفيذ السحب باستخدام cURL
$content = fetchRemoteFile($current_link);
if ($content) {
if (file_put_contents($target, $content)) {
@watermark($target, $ext, 'logo/logo.png');
file_put_contents("./files/datte.txt", "$description,$new_name,$ss,$ip\n", FILE_APPEND);
echo "✅ تم سحب: <a href='".$site_url.$target."' target='_blank'>$new_name</a> (الحجم: ".convertToReadableSize(strlen($content)).")<br>";
}
} else {
echo "❌ فشل سحب: $current_link (الموقع قد يكون محمياً أو الرابط غير مباشر)<br>";
}
}
}
}
?>
<!DOCTYPE html>
<html dir="rtl" lang="ar">
<head>
<meta charset="utf-8">
<title>مركز سحب ورفع شامل</title>
<style>
body { font-family: Arial, sans-serif; margin: 30px; background: #f0f2f5; text-align: center; }
.container { background: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); display: inline-block; width: 100%; max-width: 500px; }
input { width: 90%; padding: 12px; margin: 10px 0; border: 1px solid #ddd; border-radius: 6px; }
input[type="submit"] { background: #007bff; color: white; border: none; cursor: pointer; font-weight: bold; }
input[type="submit"]:hover { background: #0056b3; }
label { font-weight: bold; color: #333; float: right; margin-right: 5%; }
</style>
</head>
<body>
<div class="container">
<h2>🚀 سحب ورفع الملفات من أي موقع</h2>
<form action="" method="post" enctype="multipart/form-data">
<label>روابط السحب (ويكيبيديا، صور، إلخ):</label>
<input type="text" placeholder="ضع الرابط هنا" name="url" />
<input type="text" placeholder="رابط إضافي" name="urls" />
<label>الإعدادات:</label>
<input type="text" placeholder="وصف الملف" name="desc" />
<input type="text" placeholder="تغيير الامتداد (مثلاً zip)" name="ppp" />
<hr>
<label>رفع من جهازك:</label>
<input type="file" name="image[]" multiple />
<input type="submit" value="ابدأ العملية الآن" />
</form>
</div>
</body>
</html>