01.
<?
02.
header(
"Content-Type: text/html; Charset=SJIS"
);
03.
header(
"Expires: Wed, 31 May 2000 14:59:58 GMT"
);
04.
05.
06.
require_once
(
'zip.lib.php'
);
07.
08.
if
(
$_GET
[
'send'
] !=
''
) {
09.
10.
11.
$flist
=
array
();
12.
13.
14.
$zipname
=
date
(
"ymd_His"
);
15.
16.
17.
$zipfile
=
new
zipfile();
18.
19.
20.
preg_match_all(
'/(?:")?(http:\/\/[^\s"]+)/'
,
21.
file_get_contents
(
$_GET
[
'url'
]),
$matches
);
22.
23.
24.
$get_array
=
array_unique
(
$matches
[1]);
25.
26.
27.
set_time_limit( 0 );
28.
29.
30.
foreach
(
$get_array
as
$value
){
31.
if
(preg_match(
"/(gif|jpg|png|jpeg)$/i"
,
$value
)){
32.
array_push
(
$flist
,
$value
);
33.
}
34.
}
35.
36.
37.
for
(
$i
= 0;
$i
<
count
(
$flist
);
$i
++){
38.
39.
40.
$handle
=
file_get_contents
(
$flist
[
$i
]);
41.
42.
43.
$zipfile
-> addFile(
$handle
,
basename
(
$flist
[
$i
]) );
44.
45.
}
46.
47.
48.
$zip_buffer
=
$zipfile
->file();
49.
50.
header(
"Content-Type: application/octet-stream"
);
51.
header(
"Content-disposition: attachment; filename=img"
.
$zipname
.
".zip"
);
52.
header(
"Content-Length: "
.
strlen
(
$zip_buffer
));
53.
54.
55.
56.
print
$zip_buffer
;
57.
58.
}
59.
60.
?>
0 件のコメント:
コメントを投稿