comparison index.php @ 43:dbc006408d2b

ASSUMES we have SetEnv PHP_VALUE "include_path =.:/var/test/private:/var/test/ywww:/usr/share/php" in apache2/.../test.conf use dl(...) for debug logging, defined in dlog.php use doAmazonRequest in amazonBookSearch use ../private/web.php (q.v., not in mercurial) for Aserver and Aassociates Started by updating from 40:c24ae74bf6d5, i.e. just before the bug on the main line
author Charlie Root
date Sat, 05 Jan 2019 18:00:10 -0500
parents 1bb0bc3d306a
children 38d209611508
comparison
equal deleted inserted replaced
42:3f400072bf14 43:dbc006408d2b
1 <?php 1 <?php
2 include_once "dlog.php";
2 3
3 if (isset($_SERVER["GEOIP_COUNTRY_CODE"])) { 4 if (isset($_SERVER["GEOIP_COUNTRY_CODE"])) {
4 $country_code = $_SERVER["GEOIP_COUNTRY_CODE"]; 5 $country_code = $_SERVER["GEOIP_COUNTRY_CODE"];
5 } 6 }
6 elseif (isset($_SERVER["REDIRECT_GEOIP_COUNTRY_CODE"])) { 7 elseif (isset($_SERVER["REDIRECT_GEOIP_COUNTRY_CODE"])) {
7 $country_code = $_SERVER["REDIRECT_GEOIP_COUNTRY_CODE"]; 8 $country_code = $_SERVER["REDIRECT_GEOIP_COUNTRY_CODE"];
8 } 9 }
9 else {$country_code = "US" ; } 10 else {$country_code = "US" ; }
10 file_put_contents('/var/ywww/debug/phpDebug', 11
11 "cc: $country_code\n", 12 dl("cc: $country_code\n");
12 FILE_APPEND);
13 13
14 switch($country_code) { 14 switch($country_code) {
15 case "CA": 15 case "CA":
16 Header( "HTTP/1.1 301 Moved Permanently" ); 16 Header( "HTTP/1.1 301 Moved Permanently" );
17 Header ("Location: http://www.yournextread.com/ca/" ); 17 Header ("Location: http://test.markup.co.uk/ywww/ca/" );
18 break; 18 break;
19 case "DE": 19 case "DE":
20 Header( "HTTP/1.1 301 Moved Permanently" ); 20 Header( "HTTP/1.1 301 Moved Permanently" );
21 Header ("Location: http://www.yournextread.com/de/" ); 21 Header ("Location: http://test.markup.co.uk/ywww/de/" );
22 break; 22 break;
23 case "FR": 23 case "FR":
24 Header( "HTTP/1.1 301 Moved Permanently" ); 24 Header( "HTTP/1.1 301 Moved Permanently" );
25 Header ("Location: http://www.yournextread.com/fr/" ); 25 Header ("Location: http://test.markup.co.uk/ywww/fr/" );
26 break; 26 break;
27 case "GB": 27 case "GB":
28 Header( "HTTP/1.1 301 Moved Permanently" ); 28 Header( "HTTP/1.1 301 Moved Permanently" );
29 Header ("Location: http://www.yournextread.com/uk/" ); 29 Header ("Location: http://test.markup.co.uk/ywww/uk/" );
30 break; 30 break;
31 case "US": 31 case "US":
32 Header( "HTTP/1.1 301 Moved Permanently" ); 32 Header( "HTTP/1.1 301 Moved Permanently" );
33 Header ("Location: http://www.yournextread.com/us/" ); 33 Header ("Location: http://test.markup.co.uk/ywww/us/" );
34 break; 34 break;
35 default: 35 default:
36 Header( "HTTP/1.1 301 Moved Permanently" ); 36 Header( "HTTP/1.1 301 Moved Permanently" );
37 Header ("Location: http://www.yournextread.com/us/" ); 37 Header ("Location: http://test.markup.co.uk/ywww/us/" );
38 break; 38 break;
39 } 39 }
40 ?> 40 ?>
41 <html> 41 <html>
42 <head> 42 <head>