-
Notifications
You must be signed in to change notification settings - Fork 0
/
go.php
executable file
·42 lines (36 loc) · 1.01 KB
/
go.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
<?php
/** Last remnants of super retro PHP code */
require_once './inc/blocked_terms.conf.php';
if ( empty($myDomain) ) {
if ( !empty($_SERVER['HTTP_HOST'] ) ) {
$myDomain = $_SERVER['HTTP_HOST'];
} else if ( !empty($_SERVER['SERVER_NAME']) ) {
$myDomain = $_SERVER['SERVER_NAME'];
} else {
$myDomain = false;
}
}
$searchEngines = array (
"de" => array(
"wikipedia" => 'http://de.wikipedia.org/wiki/Special:Search?ns0=1&search=$1'
)
);
if (!isset($_GET["l"]) || !$_GET["l"]) {
header("Location: http://".$myDomain);
die($myDomain);
}
$l = stripslashes($_GET["l"]);
if (!isset($_GET["q"]) || !$_GET["q"]) {
header("Location: http://$l.wikipedia.org/wiki/Special:Search?profile=advanced");
die($myDomain);
}
$q = stripslashes($_GET["q"]);
$url = $searchEngines[$l][$_GET["e"]];
if (preg_match($blockedPages, $q)) {
$url = 'http://'.$myDomain.'/censored.php';
} else {
$url = 'http://'.$l.'.wikipedia.org/wiki/'.str_replace("%2F","/",urlencode(str_replace(" ","_",$q)));
}
header("Location: ".$url);
exit;
?>