Browse Source

Make country selection PHP script less lousy

Steven Grimm 5 years ago
parent
commit
0efcc5314a
1 changed files with 44 additions and 43 deletions
  1. 44
    43
      episodes.php

+ 44
- 43
episodes.php View File

@@ -1,54 +1,55 @@
1 1
 <?php
2 2
 
3 3
 $domains = array(
4
-  '.euro.net' => 'countries/nl/eplist.html',
5
-  '.pr.us' => 'countries/pr/eplist.html',
6
-  '.ar' => 'countries/wbtv/eplist.html',
7
-  '.at' => 'countries/at/eplist.html',
8
-  '.au' => 'countries/au/eplist.html',
9
-  '.au' => 'countries/au/eplist.html',
10
-  '.be' => 'countries/be/eplist.html',
11
-  '.br' => 'countries/wbtv/eplist.html',
12
-  '.ca' => 'countries/ca/eplist.html',
13
-  '.cl' => 'countries/cl/eplist.html',
14
-  '.co' => 'countries/co/eplist.html',
15
-  '.cr' => 'countries/cr/eplist.html',
16
-  '.cz' => 'countries/cz/eplist.html',
17
-  '.de' => 'countries/de/eplist.html',
18
-  '.es' => 'countries/es/eplist.html',
19
-  '.fi' => 'countries/fi/eplist.html',
20
-  '.fr' => 'countries/fr/eplist.html',
21
-  '.gb' => 'countries/uk/eplist.html',
22
-  '.gr' => 'countries/gr/eplist.html',
23
-  '.id' => 'countries/id/eplist.html',
24
-  '.ie' => 'countries/uk/eplist.html',
25
-  '.il' => 'countries/il/eplist.html',
26
-  '.it' => 'countries/it/eplist.html',
27
-  '.jo' => 'countries/jo/eplist.html',
28
-  '.my' => 'countries/id/eplist.html',
29
-  '.nl' => 'countries/nl/eplist.html',
30
-  '.no' => 'countries/no/eplist.html',
31
-  '.nz' => 'countries/nz/eplist.html',
32
-  '.pe' => 'countries/pe/eplist.html',
33
-  '.ph' => 'countries/ph/eplist.html',
34
-  '.pk' => 'countries/pk/eplist.html',
35
-  '.pl' => 'countries/pl/eplist.html',
36
-  '.pt' => 'countries/pt/eplist.html',
37
-  '.ru' => 'countries/ru/eplist.html',
38
-  '.se' => 'countries/se/eplist.html',
39
-  '.sg' => 'countries/sg/eplist.html',
40
-  '.si' => 'countries/si/eplist.html',
41
-  '.uk' => 'countries/uk/eplist.html',
42
-  '' => 'countries/us/eplist.html',
4
+  '.euro.net' => 'nl',
5
+  '.pr.us' => 'pr',
6
+  '.ar' => 'wbtv',
7
+  '.at' => 'at',
8
+  '.au' => 'au',
9
+  '.au' => 'au',
10
+  '.be' => 'be',
11
+  '.br' => 'wbtv',
12
+  '.ca' => 'ca',
13
+  '.cl' => 'cl',
14
+  '.co' => 'co',
15
+  '.cr' => 'cr',
16
+  '.cz' => 'cz',
17
+  '.de' => 'de',
18
+  '.es' => 'es',
19
+  '.fi' => 'fi',
20
+  '.fr' => 'fr',
21
+  '.gb' => 'uk',
22
+  '.gr' => 'gr',
23
+  '.id' => 'id',
24
+  '.ie' => 'uk',
25
+  '.il' => 'il',
26
+  '.it' => 'it',
27
+  '.jo' => 'jo',
28
+  '.my' => 'id',
29
+  '.nl' => 'nl',
30
+  '.no' => 'no',
31
+  '.nz' => 'nz',
32
+  '.pe' => 'pe',
33
+  '.ph' => 'ph',
34
+  '.pk' => 'pk',
35
+  '.pl' => 'pl',
36
+  '.pt' => 'pt',
37
+  '.ru' => 'ru',
38
+  '.se' => 'se',
39
+  '.sg' => 'sg',
40
+  '.si' => 'si',
41
+  '.uk' => 'uk',
42
+  '' => 'us',
43 43
 );
44 44
 
45 45
 $remote_host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
46 46
 $server_name = $_SERVER['SERVER_NAME'];
47 47
 
48
-foreach ($domains as $suffix => $url) {
49
-	if (!$suffix || substr($remote_host, -strlen($suffix)) == $suffix) {
50
-		header("Location: http://$server_name/lurk/$url");
51
-	}
48
+foreach ($domains as $suffix => $cnt) {
49
+  if (!$suffix || substr($remote_host, -strlen($suffix)) == $suffix) {
50
+    header("Location: http://$server_name/lurk/countries/$cnt/eplist.html");
51
+    exit(0);
52
+  }
52 53
 }
53 54
 
54 55
 print file_get_contents('internal/dom-error.html');

Loading…
Cancel
Save