Mercurial > hg > ywww
annotate index.php @ 28:b058736bc9ad
fix old :-( preg bug
author | Robert Boland <robert@markup.co.uk> |
---|---|
date | Fri, 04 Jan 2019 08:48:00 -0500 |
parents | 1bb0bc3d306a |
children | dbc006408d2b |
rev | line source |
---|---|
27
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
1 <?php |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
2 |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
3 if (isset($_SERVER["GEOIP_COUNTRY_CODE"])) { |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
4 $country_code = $_SERVER["GEOIP_COUNTRY_CODE"]; |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
5 } |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
6 elseif (isset($_SERVER["REDIRECT_GEOIP_COUNTRY_CODE"])) { |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
7 $country_code = $_SERVER["REDIRECT_GEOIP_COUNTRY_CODE"]; |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
8 } |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
9 else {$country_code = "US" ; } |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
10 file_put_contents('/var/ywww/debug/phpDebug', |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
11 "cc: $country_code\n", |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
12 FILE_APPEND); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
13 |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
14 switch($country_code) { |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
15 case "CA": |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
16 Header( "HTTP/1.1 301 Moved Permanently" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
17 Header ("Location: http://www.yournextread.com/ca/" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
18 break; |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
19 case "DE": |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
20 Header( "HTTP/1.1 301 Moved Permanently" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
21 Header ("Location: http://www.yournextread.com/de/" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
22 break; |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
23 case "FR": |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
24 Header( "HTTP/1.1 301 Moved Permanently" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
25 Header ("Location: http://www.yournextread.com/fr/" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
26 break; |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
27 case "GB": |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
28 Header( "HTTP/1.1 301 Moved Permanently" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
29 Header ("Location: http://www.yournextread.com/uk/" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
30 break; |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
31 case "US": |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
32 Header( "HTTP/1.1 301 Moved Permanently" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
33 Header ("Location: http://www.yournextread.com/us/" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
34 break; |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
35 default: |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
36 Header( "HTTP/1.1 301 Moved Permanently" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
37 Header ("Location: http://www.yournextread.com/us/" ); |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
38 break; |
1bb0bc3d306a
update where to look for geoip info
Robert Boland <robert@markup.co.uk>
parents:
20
diff
changeset
|
39 } |
0 | 40 ?> |
41 <html> | |
42 <head> | |
43 <title>YourNextRead: Book Recommendations</title> | |
44 | |
45 <META NAME="Description" CONTENT="YourNextRead recommends your next book. YourNextRead provides a book recommendation system showing aggregated book reviews, updated by real peoples opinions, in a simple visual map, helping you to decide 'What Should I Read Next?'. Perfect for both bookworms and casual readers!"> | |
46 <meta name="google-site-verification" content="0XCtbGM_bvOH363P2XE6DVjh-APTICOREquY8F38T84" /> | |
47 </HEAD> | |
48 <body> | |
19 | 49 <script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=322bafc0-69fa-4664-8e1c-0b9159259748"></script> |
0 | 50 </body> |
51 |