view index.php @ 50:99a730ffeaf6

more parameterisation
author Charlie Root
date Sun, 27 Jan 2019 14:24:02 -0500
parents a67bf725e87b
children
line wrap: on
line source

<?php
include_once "dlog.php";

if (isset($_SERVER["GEOIP_COUNTRY_CODE"])) {
$country_code = $_SERVER["GEOIP_COUNTRY_CODE"];
 }
elseif (isset($_SERVER["REDIRECT_GEOIP_COUNTRY_CODE"])) {
$country_code = $_SERVER["REDIRECT_GEOIP_COUNTRY_CODE"];
 }
 else {$country_code = "US" ; }

dl("cc: $country_code\n");
dl("tp: ".getenv("TEST_PREFIX")."\n");
dl("ip: ".getenv("IP_PREFIX")." ".ini_get('include_path')."\n");
   
$home=$_SERVER['SERVER_NAME'];
$path=$_SERVER['SCRIPT_NAME'];
$myBase="http://$home".substr($path,0,strlen($path)-10);
dl("base: $myBase\n");

switch($country_code) {
 case "CA":
   Header( "HTTP/1.1 301 Moved Permanently" );
   Header ("Location: $myBase/ca/" );
   break;
 case "DE":
   Header( "HTTP/1.1 301 Moved Permanently" );
   Header ("Location: $myBase/de/" );
   break;
 case "FR":
   Header( "HTTP/1.1 301 Moved Permanently" );
   Header ("Location: $myBase/fr/" );
   break;			
 case "GB":
   Header( "HTTP/1.1 301 Moved Permanently" );
   Header ("Location: $myBase/uk/" );
   break;
 case "US":
   Header( "HTTP/1.1 301 Moved Permanently" );
   Header ("Location: $myBase/us/" );
   break;
 default:
   Header( "HTTP/1.1 301 Moved Permanently" );
   Header ("Location: $myBase/us/" );
   break;	
 }	  
	?>
<html>
		  <head>
		  <title>YourNextRead: Book Recommendations</title>

        <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!">
        <meta name="google-site-verification" content="0XCtbGM_bvOH363P2XE6DVjh-APTICOREquY8F38T84" />
</HEAD>
<body>
<script src="//z-na.amazon-adsystem.com/widgets/onejs?MarketPlace=US&adInstanceId=322bafc0-69fa-4664-8e1c-0b9159259748"></script>
</body>