-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathderefer.php
executable file
·48 lines (40 loc) · 1.06 KB
/
derefer.php
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
<?php
if (isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])
&& !preg_match('/^https?:\/\/[a-z0-9]+\.(4chan|4channel)\.org/', $_SERVER['HTTP_REFERER'])) {
http_response_code(403);
die();
}
if (!isset($_GET['url']) || empty($_GET['url'])) {
die();
}
$url = $_GET['url'];
$domain = parse_url($url, PHP_URL_HOST);
if (!$domain) {
die();
}
if (strpos($url, 'http') !== 0) {
$url = 'http://' . $url;
}
$domain = htmlspecialchars($domain, ENT_QUOTES);
$url = htmlspecialchars(htmlspecialchars_decode($url, ENT_QUOTES), ENT_QUOTES);
header("Cache-Control: public, immutable");
?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting...</title>
<meta http-equiv="refresh" content="2; URL=<?php echo $url ?>">
<style type="text/css">
#msg {
font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
text-align: center;
font-weight: bold;
font-size: 36pt;
margin-top: 20%;
}
</style>
</head>
<body>
<div id="msg">Redirecting you to <i><?php echo $domain ?></i>...</div>
</body>
</html>