This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
removesite.php
107 lines (88 loc) · 3.14 KB
/
removesite.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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
require_once("ui.inc");
require_once("urls.inc");
$gTitle = "Remove Your Site";
$gRurl = getParam("rurl", "");
?>
<!doctype html>
<html>
<head>
<title><?php echo $gTitle ?></title>
<meta charset="UTF-8">
<?php echo headfirst() ?>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<?php echo uiHeader($gTitle); ?>
<h1><?php echo $gTitle ?></h1>
<?php
$is_valid_url = false;
$url_to_fetch = "";
$bRemovalConfirmed = false;
if ( $gRurl ) {
// Do some basic validation
$is_valid_url = preg_match("/^(http|https):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i", $gRurl);
if ( ! $is_valid_url ) {
echo "<p class=warning>The URL entered is invalid: $gRurl</p>\n";
}
else {
$existingUrl = urlExists($gRurl);
if ( ! $existingUrl ) {
echo "<p class=warning>Nothing to remove - the URL \"$gRurl\" doesn't exist in the HTTP Archive.</p>\n";
}
else {
// make sure we have a trailing slash
$url_to_fetch = substr($gRurl, -1) == '/' ? $gRurl : $gRurl . '/';
$url_to_fetch .= 'removehttparchive.txt';
// This requires setting this in php.ini: allow_url_fopen = On
$bRemovalConfirmed = ( FALSE === @fetchUrl($url_to_fetch) ? false : true );
if ( ! $bRemovalConfirmed ) {
echo "<p class=warning><a href='$url_to_fetch' style='text-decoration: underline; color: #870E00;'>$url_to_fetch</a> was not found.<br>$gRurl is still archived.</p>\n";
}
else {
removeSite($gRurl); // queue it for removal
echo "<p class=warning style='margin-bottom: 0;'>$gRurl will be removed within five business days.</p>\n<p style='margin-top: 0;'>You can remove removehttparchive.txt now.</p>";
}
}
}
}
?>
<script type="text/javascript">
function confirmRemove() {
var url = document.getElementById("rurl").value;
if ( ! url ) {
alert("Please enter a URL.");
}
else if ( confirm("This will remove ALL DATA about " + url + " and remove it from all future archiving. Do you want to continue?") ) {
return true;
}
return false;
}
</script>
<p>
Follow these steps to remove your website's data from the HTTP Archive and prevent further archiving.
</p>
<ol style="margin-left: 2em;">
<form name=removesite action="<? echo $_SERVER['PHP_SELF'] ;?>" onsubmit="return confirmRemove()">
<li> Enter your URL:
<span class="ui-widget" style="font-size: 1em;">
<input id="rurl" name="rurl" style="margin: 0;" size=35 />
</span>
<li> Create a file called <code>removehttparchive.txt</code> at that URL.
<li> Click here: <input type="submit" value="Remove" name="submit" placeholder="http://www.example.com" style="margin: 0;" />
</form>
</ol>
<?php echo uiFooter() ?>
</body>
</html>