منذ 4 ساعة مضت
السلام عليكم
اريد من الاخوه الاعزاء تعديل هذا الملف ليسحب ملفين من رابطين مختلفين وحبذا لو استخدم متغير
اريد من الاخوه الاعزاء تعديل هذا الملف ليسحب ملفين من رابطين مختلفين وحبذا لو استخدم متغير
كود :
$r=0;
مثلا
$url=$_POST['url']['$r'];هذا الكود
PHP كود :
<?php
@header('Content-type: text/html;charset=windows-1256');
$opts = array(
'http'=>array(
'method'=>"GET",
'timeout'=>1,
'ignore_errors'=> true
)
);
$context = stream_context_create
(["http" => array(
"header" => "User-Agent:Mozilla/5.0 (Linux; Android 5.0; SM-G900FD) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.74 Mobile Safari/537.36"
),
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
]
);
//$contexttt = stream_context_create($opts);
/* $file = 'https://vb4arb.com/vb/attachment.php?aid=30174';
$newfile = '/home/xxx/domains/xxx.com/public_html/uploads/gooo.jpg';
(copy($file, $newfile,false,$contexttt));
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}*/
//error_reporting(E_ALL);
date_default_timezone_set("Asia/riyadh");
//include("downloads.php");
/*
$agent = $_SERVER["HTTP_USER_AGENT"];
if( preg_match('/MSIE (\d+\.\d+);/', $agent) ) {
echo "You're using Internet Explorer";
} else if (preg_match('/Chrome[\/\s](\d+\.\d+)/', $agent) ) {
echo "You're using Chrome";
} else if (preg_match('/Edge\/\d+/', $agent) ) {
echo "You're using Edge";
} else if ( preg_match('/Firefox[\/\s](\d+\.\d+)/', $agent) ) {
echo "You're using Firefox";
} else if ( preg_match('/OPR[\/\s](\d+\.\d+)/', $agent) ) {
echo "You're using Opera";
} else if (preg_match('/Safari[\/\s](\d+\.\d+)/', $agent) ) {
echo "You're using Safari";
}
*/
//ini_set('user_agent', 'My-Application/2.5');
function watermark($name, $ext, $logo){
if (preg_match("/jpg|jpeg/",$ext)){$src_img=imagecreatefromjpeg($name);}
if (preg_match("/webp/",$ext)){$src_img=imagecreatefromwebp($name);}
if (preg_match("/png/",$ext)){$src_img=imagecreatefrompng($name);}
if (preg_match("/gif/",$ext)){$src_img=imagecreatefromgif($name);}
// if (preg_match("/svg/",$ext)){$src_img=imagecreatefromsvg($name);}
$src_logo = imagecreatefrompng($logo);
$bwidth = imageSX($src_img);
$bheight = imageSY($src_img);
$lwidth = imageSX($src_logo);
$lheight = imageSY($src_logo);
//fix bug for 1beta3
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/",$ext)){imagejpeg($src_img, $name);}
if (preg_match("/png/",$ext)){imagepng($src_img, $name);}
if (preg_match("/webp/",$ext)){imagewebp($src_img, $name);}
if (preg_match("/gif/",$ext)){imagegif($src_img, $name);}
// if (preg_match("/svg/",$ext)){imagesvg($src_img, $name);}
}# < 150
else
{
return false;
}
}
//blog.theonlytutorials.com
//blog.theonlytutorials.com
//author: agurchand
$memory_limit='128M';
$max_execution_time='300';
if($_POST){
//get the url
$url = $_POST['url'];
$urls = $_POST['urls'];
//add time to the current
$newname= basename($urls);
//add time to the current filename
$name = basename($url);
list($txt, $ext ) = explode(".", $name);
list($txt, $type ) = explode(".", $newname);
function convertToReadableSize($size){
$base = log($size) / log(1024);
$suffix = array("", "KB", "MB", "GB", "TB");
$f_base = floor($base);
return round(pow(1024, $base - floor($base)), 1) . $suffix[$f_base];
}
/*$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL,'$url');
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, '$name');
$name = curl_exec($curl_handle);
curl_close($curl_handle);*/
function curl($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
return curl_exec($ch);
curl_close ($ch);
}
function file_get_html() {
$dom = new simple_html_dom;
$args = func_get_args();
$dom->load(call_user_func_array('curl', $args), true);
return $dom;
}
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch,CURLOPT_HEADER, TRUE); curl_setopt($ch,CURLOPT_NOBODY, TRUE); $name = curl_exec($ch);
$size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); curl_close($ch);
$sizee= convertToReadableSize($size);
//list($width, $height) = getimagesize($url);
$name = date('d-m-Y-H:i:s', time());
//time();
$password = trim($ext);
// <--- this is not a good idea!
if((strlen($password) > 4) or $ext=="svg")
{
$ext="jpg";
// $uploadOk = 0;
}
$name = $name.".".$ext;
$newname = $newname."".$type;
//$namess = basename($url);
$files = new SplFileInfo($name);
$exttt = $files->getExtension();
//PATHINFO_EXTENSION
$extt = pathinfo($name,PATHINFO_EXTENSION);
//if($exttt==""){$ext=".jpg";}
$file_ext = (explode('.', $name));
$end = end($file_ext);
//$ext="jpg";
$ext=".jpg".$ext;
$type="".$type;
// $ext = end($sepext);
/*$t=array('jpg' , 'png' , 'gif','ip' , 'rar');
if(!in_array($ext,$t))
{ echo gggg;}else {
*/
//$namee="http://xxx.com/uploads/$name";
//$size3= getimagesize("http://xxx.com/uploads/07-04-2026-21:16:01.jpg");
//$size2= filesize("http://xxx.com/uploads/07-04-2026-22:20:46.webp") . ' bytes';
//$size1=convertToReadableSize("$namee");
//here is the actual code to get the file from the url and save it to the uploads folder
//get the file from the url using file_get_contents and put it into the folder using file_put_contents
require_once("files/ip.php");
$ip = $user_ip;
$description = strip_tags($_POST['desc']);
$descriptions="$description,$name,$ip";
$namess="ddd";/*
$filelist = fopen("./files/".$namess.".mfh","w");
fwrite($filelist, $name ."|". name ."|". $passkey ."|". $userip ."|". $time."|0|".$description."|".$passwerd."|".$cat."|".$_POST['pprotect']."|\n");*/
//$password=$_GET['password'];
$fh = fopen("./files/".$namess.".mfh","a+"); fwrite($fh,$descriptions."\n");
//write to txtfile
//fwrite($fh,$password."\n");
// write to txtfile
fclose($fh);
$fileplacee="uploads";
@wateermark($fileplacee."/".$newname,$type,'logo/logo.png');
$newfile = '/home/xxx/domains/xxx.com/public_html/uploads/'.time().'.'.$type.'';
(copy($urls, $newfile));
$upload = file_put_contents("uploads/$name",file_get_contents($url,false,$context));
$fileplace="uploads";
@watermark($fileplace."/".$name,$ext,'logo/logo.png');
//include('Thumbnail.class.php');
// $thumb=new Thumbnail("$name");
// $thumb->quality='100';
// $thumb->process();
// generate image
// $thumb->save("$name");
$filesk= "$name";
//$name = str_replace("?format=jpg","gg",$filesk);
//echo $TXTREM ;
//check success
//$info = getimagesize('http://xxx.com/uploads/$name');
/*$tmp= tmpfile();
$names= "http://xxx.com/uploads/$name";
$ch=curl_init($url);
curl_setopt_array($ch,array(
CURLOPT_FILE=>$tmp,
CURLOPT_ENCODING=>''
));
curl_exec($ch);
curl_close($ch);
list($width, $height) = getimagesize($names);
fclose($tmp);
$filename = "http://xxx.com/uploads/07-04-2026-22:20:46.webp";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);*/
//$ss=filesize($name);
$newfile= str_replace("/home/xxx/domains/xxx.com/public_html/","http://xxx.com/","$newfile");
if($upload)
echo "Success:$name,<br> type: $extt, size: $sizee,$newfile,<br>$name2 <a href='uploads/".$name."' target='_blank'>Check Uploaded</a>"; else "please check your folder permission";
}
//}
?>
<html>
<head><title>Theonlytutorials - Simple File Upload from URL Script!</title></head>
<body>
<h3>Theonlytutorials.com - Very Simple File Upload from URL Script!</h3>
<form action="" method="post">
Your URL: <input type="text" name="url" />
<input type="text" name="urls" />
<input type="text" name="desc" />
<input type="submit" value="upload Images" name="upload"/>
</form>
</body>
</html>
مشكورين مقدما
