annotate index.php @ 36:e570b199108b

use doAmazonRequest
author Charlie Root
date Fri, 04 Jan 2019 12:59:40 -0500
parents 1bb0bc3d306a
children dbc006408d2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
5f4560ac65b7 original
robert
parents:
diff changeset
40 ?>
5f4560ac65b7 original
robert
parents:
diff changeset
41 <html>
5f4560ac65b7 original
robert
parents:
diff changeset
42 <head>
5f4560ac65b7 original
robert
parents:
diff changeset
43 <title>YourNextRead: Book Recommendations</title>
5f4560ac65b7 original
robert
parents:
diff changeset
44
5f4560ac65b7 original
robert
parents:
diff changeset
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!">
5f4560ac65b7 original
robert
parents:
diff changeset
46 <meta name="google-site-verification" content="0XCtbGM_bvOH363P2XE6DVjh-APTICOREquY8F38T84" />
5f4560ac65b7 original
robert
parents:
diff changeset
47 </HEAD>
5f4560ac65b7 original
robert
parents:
diff changeset
48 <body>
19
84a412b8122c try to protect against a range of missing info
Charlie Root
parents: 16
diff changeset
49 <script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=322bafc0-69fa-4664-8e1c-0b9159259748"></script>
0
5f4560ac65b7 original
robert
parents:
diff changeset
50 </body>
5f4560ac65b7 original
robert
parents:
diff changeset
51