تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] اريد سحب ملفين مثلا من رابطين مختلفين في الكود
#1
السلام عليكم
اريد من الاخوه الاعزاء تعديل هذا الملف ليسحب ملفين من رابطين مختلفين وحبذا لو استخدم متغير
كود :
$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_imgtrue);
    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
$newnamebasename($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($chCURLOPT_URL,$url);
    curl_setopt($chCURLOPT_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_RETURNTRANSFERTRUE); 
curl_setopt($ch,CURLOPT_HEADERTRUE); curl_setopt($ch,CURLOPT_NOBODYTRUE); $name curl_exec($ch);
$size curl_getinfo($chCURLINFO_CONTENT_LENGTH_DOWNLOAD); curl_close($ch);
$sizeeconvertToReadableSize($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);
$newfilestr_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> 
حاولت فيه مااستطعت
مشكورين مقدما
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [سؤال] اريد كودين php الاول وصف لملف والاخر اظهار الوصف nnnjk 8 351 منذ 6 ساعة مضت
آخر رد: nnnjk
  [سؤال] اريد اضافة ختم الصور لملف الرفع هذا nnnjk 0 122 17-04-26, 10:17 AM
آخر رد: nnnjk
Information اريد تنسيق جدول هذه الصفحه nnnjk 0 153 16-04-26, 03:21 PM
آخر رد: nnnjk
  [سؤال] اريد متغير استبدال كلمتين بكلمتين كلا على حده nnnjk 0 207 11-04-26, 11:51 PM
آخر رد: nnnjk
  [كود] اريد دمج هذين الكودين بكود واحد nnnjk 2 285 06-04-26, 07:29 PM
آخر رد: nnnjk
  [سؤال] تغيير الكود ليتوافق مع تفعيل خاصية safe mode nnnjk 11 428 06-04-26, 02:20 AM
آخر رد: nnnjk
  طلب اضافة ختم الصور لهذا الكود nnnjk 48 1,064 05-04-26, 03:40 PM
آخر رد: Amir_Alzubidy
  [سؤال] فنكشن vb . net اريد تحويله الي فنكشن php او اي طريقة تؤدي نفس الوظيف الماجيك مسعد 2 1,681 31-03-20, 07:27 PM
آخر رد: الماجيك مسعد
  [سؤال] اريد نموذج تسجيل ramygamalvb 1 2,014 21-01-20, 11:06 PM
آخر رد: abubasilIraq
  عندي معلومات في ملف نصي اريد استخرج القيمة على حسب اعلى رقم abumuhannadzym 3 1,788 19-12-19, 11:13 PM
آخر رد: abumuhannadzym

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم