-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathproxy.php
More file actions
31 lines (25 loc) · 767 Bytes
/
proxy.php
File metadata and controls
31 lines (25 loc) · 767 Bytes
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
<?php
function sanitize($text) {
$tmp = trim($text);
$old = array("\'", "\"", "?", "!", "*", "(", ")", "[", "]", "{", "}");
$new = array("", "", "", "", "", "", "", "", "", "", "" );
$tmp = str_replace($old, $new, $tmp);
return $tmp;
}
// path must be always relative
function sanitize_image($text) {
$tmp = sanitize($text);
$tmp = ltrim($tmp, "/\\.");
return $tmp;
}
$image_filename = sanitize_image($_GET['i']);
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $image_filename);
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
?>