Upload page code
$url = "HTTP://192.168.1.100/UPLOAD.PHP?LANG=CN"; #可以get传相应参数
$file = $path. ' /'. $Icon; The file to be uploaded
$fields [' f '] = ' @ '. $file;
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_post, 1);
curl_setopt ($ch, Curlopt_postfields, $fields);
Curl_exec ($ch);
if ($error = Curl_error ($ch)) {
die ($error);
}
Curl_close ($ch);
Receive picture Resources
Date_default_timezone_set (' Asia/shanghai ');
Set time zone $ip = '; if (getenv (' http_client_ip ') && strcasecmp (getenv (' http_client_ip '), ' unknown ')) {$ip = getenv (' http_client
_ip '); }elseif (getenv (' http_x_forwarded_for ') && strcasecmp (getenv (' http_x_forwarded_for '), ' unknown ')) {$ip = ge
Tenv (' http_x_forwarded_for '); }elseif (getenv (' remote_addr ') && strcasecmp (getenv (' remote_addr '), ' unknown ')) {$ip = getenv (' remote_addr ')
); }elseif (Isset ($_server[' remote_addr ']) && $_server[' remote_addr '] && strcasecmp ($_server[' Remote_
ADDR '], ' unknown ') {$ip = $_server[' remote_addr ']; } preg_match ("/[\d\.]
{7,15}/", $ip, $ipmatches); $ip = $ipmatches [0]?
$ipmatches [0]: ' Unknown ';
Please ask for IP, set whitelist $date = Date ("[Y-m-d h:i:s]");
$allowip = Array (' 192.168.1.100 ');
if (!in_array ($ip, $allowip)) {$ipVal = "{$date} {$ip}\n";
File_put_contents (' Upload_ip.log ', $ipVal, File_appen); Die (-1); //Receive get reference $lang = isset ($_request[' Lang '])?
$_request[' Lang ']: ' CN ';
$uploaddir = "/data/cdncache/res/gifts/{$lang}/"; $uploadfile = $uploaddir.
$_files[' f ' [' name '];
if (Move_uploaded_file ($_files[' f '] [' tmp_name '], $uploadfile)) #保存图片成功 {$type = $_files[' f '] [' type '];
$tmp _name = $_files[' f ' [' tmp_name '];
$error = $_files[' f '] [' ERROR '];
$size = $_files[' f '] [' size ']; $log _txt = ' name: '. $_files[' f ' [' name ']. ' Type: '. $type. ' Tmp_name: '. $tmp _name. ' ERROR: '. $error. ' Size: '. $size. "Hello". ' Lang: '.
$_request[' Lang '];
$value = "{$date} {$log _txt}\n";
@file_put_contents (' Upload_ok.log ', $value, file_append);
Exit ();
else {$type = $_files[' f '] [' type '];
$tmp _name = $_files[' f ' [' tmp_name '];
$error = $_files[' f '] [' ERROR '];
$size = $_files[' f '] [' size ']; $log _txt = ' name: '. $_files[' f ' [' name ']. ' Type: '. $type. ' Tmp_name: '. $tmp _name. ' ERROR: '. $error. ' Size: '. $size. "Hello". ' Lang: '.
$_request[' Lang '];
$value = "{$date} {$log _txt}\n";
@file_put_contents (' Upload_ng.log ', $value, file_append);
Exit ();
}
The above is the entire contents of this article, I hope you can enjoy.