-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.php
More file actions
80 lines (76 loc) · 2.56 KB
/
debug.php
File metadata and controls
80 lines (76 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
define("POST", true);
define("GET", false);
function exit_r($array, $continue=false){
echo "<xmp>"; print_r($array);
if($continue!=true)exit();
else echo "</xmp>";
}
function curl_send($isPost, $url, $args=array(), $config = array())
{
$curl_handler = curl_init();
curl_setopt($curl_handler, CURLOPT_URL, $url);
curl_setopt($curl_handler, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_handler, CURLOPT_POST, $isPost=="POST"?1:0);
curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handler, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false);
if($config["USER_AGENT"]){
curl_setopt($curl_handler, CURLOPT_USERAGENT,$config["USER_AGENT"]);
}
if($isPost=="POST")
{
$post_args = "";
foreach($args as $key=>$value)
{
$post_args.=sprintf("%s=%s&", $key, urlencode($value));
}
curl_setopt($curl_handler, CURLOPT_POSTFIELDS, $post_args);
}
if(isset($config["header"])){
curl_setopt($curl_handler, CURLOPT_HTTPHEADER, $config["header"]);
}
if(isset($config["refer"])){
curl_setopt($curl_handler, CURLOPT_REFERER, $config["refer"]);
}
if($cookies!=""){
curl_setopt($curl_handler, CURLOPT_COOKIE, $cookies);
}
$result = curl_exec($curl_handler);
if($config["to_data_url"]){
$filetype = curl_getinfo($curl_handler, CURLINFO_CONTENT_TYPE);
curl_close($curl_handler);
return sprintf("data:%s;base64,%s", $filetype, base64_encode($result));
} else {
curl_close($curl_handler);
return $result;
}
}
function file_get_contents2($url){
return curl_send("GET", $url, array(), array('USER_AGENT'=>"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"));
}
if($_SERVER['PHP_SELF'] == "/hackday2013/debug.php"){
$url =$_GET['url'];
if(!$url) $url = "http://www.facebook.com/photo.php?fbid=10202501501164490&set=np.413901279.663898857&type=1";
exit_r(file_get_contents2($url));
}
function imageresize($img, $width, $height, $enlarge=false){ //第四個參數決定小於此圖片時是否要放大
if (!$img){
return false;
} else { //將圖片縮成width*height以內
$zoom=( ($width/ImageSX($img)) < ($height/ImageSY($img)) ?
($width/ImageSX($img)) : ($height/ImageSY($img)));
if($zoom>1 && !$enlarge)
$zoom=1;
if($zoom == 1){ //大小沒有變化,直接回傳原本的img
return $img;
} else {
$new_x=(int)(ImageSX($img)*$zoom);
$new_y=(int)(ImageSY($img)*$zoom);
$newImg = imagecreatetruecolor($new_x,$new_y);
ImageCopyResized($newImg,$img,0,0,0,0,$new_x,$new_y,ImageSX($img),ImageSY($img));
return $newImg;
}
}
}
?>