changeset 45:8bc395c87c6f

less built-in use of full site address
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Sun, 06 Jan 2019 08:09:47 -0500
parents 38d209611508
children b7376319d25a
files index.php us/index.php
diffstat 2 files changed, 20 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/index.php	Sun Jan 06 07:17:03 2019 -0500
+++ b/index.php	Sun Jan 06 08:09:47 2019 -0500
@@ -11,30 +11,35 @@
 
 dl("cc: $country_code\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: http://test.markup.co.uk/ywww/ca/" );
+   Header ("Location: $myBase/ca/" );
    break;
  case "DE":
    Header( "HTTP/1.1 301 Moved Permanently" );
-   Header ("Location: http://test.markup.co.uk/ywww/de/" );
+   Header ("Location: $myBase/de/" );
    break;
  case "FR":
    Header( "HTTP/1.1 301 Moved Permanently" );
-   Header ("Location: http://test.markup.co.uk/ywww/fr/" );
+   Header ("Location: $myBase/fr/" );
    break;			
  case "GB":
    Header( "HTTP/1.1 301 Moved Permanently" );
-   Header ("Location: http://test.markup.co.uk/ywww/uk/" );
+   Header ("Location: $myBase/uk/" );
    break;
  case "US":
    Header( "HTTP/1.1 301 Moved Permanently" );
-   Header ("Location: http://test.markup.co.uk/ywww/us/" );
+   Header ("Location: $myBase/us/" );
    break;
  default:
    Header( "HTTP/1.1 301 Moved Permanently" );
-   Header ("Location: http://test.markup.co.uk/ywww/us/" );
+   Header ("Location: $myBase/us/" );
    break;	
  }	  
 	?>
--- a/us/index.php	Sun Jan 06 07:17:03 2019 -0500
+++ b/us/index.php	Sun Jan 06 08:09:47 2019 -0500
@@ -80,7 +80,7 @@
 				<li><a href=\"http://support.microsoft.com/gp/howtoscript\">Internet Explorer</a></li>
 				</ul>
 				<p>Thank you for using YourNextRead<p>
-				<img src=\"http://test.markup.co.uk/ywww/images/topleft.gif\" alt=\"YourNextRead\"/>
+				<img src=\"../images/topleft.gif\" alt=\"YourNextRead\"/>
 				</noscript>";
 				if($iPhone && !$iPad)
 				{
@@ -112,7 +112,7 @@
 					for($i=0;$i<sizeof($xml->List[$id]->ListDetails->Book);$i++){
 						$bookTitle = $xml->List[$id]->ListDetails->Book[$i]->BookTitle;
 						$isbn = $xml->List[$id]->ListDetails->Book[$i]->ISBN;
-						echo "<a href=http://test.markup.co.uk/ywww/us/#!isbn=$isbn>$bookTitle</a> ";
+						echo "<a href=\"../us/#!isbn=$isbn\">$bookTitle</a> ";
 					}
 				}		
 			}
@@ -245,7 +245,7 @@
 				      $recommended .= " $titleL by $authorL,";
 				      $underAuthor = str_replace(" ","_",$authorL);
 				      $underTitle = str_replace(" ","_",$titleL);
-				      $linkedRecommended .= "<a href=\"http://test.markup.co.uk/ywww/us/#!isbn=$linkedISBN/$underTitle" . "_by_$authorL\">$titleL by $authorL</a>, ";		
+				      $linkedRecommended .= "<a href=\"../us/#!isbn=$linkedISBN/$underTitle" . "_by_$authorL\">$titleL by $authorL</a>, ";		
 				    }					
 				}
 				
@@ -263,7 +263,7 @@
 				<li><a href=\"http://support.microsoft.com/gp/howtoscript\">Internet Explorer</a></li>
 				</ul>
 				<p>Thank you for using YourNextRead<p>
-				<img src=\"http://test.markup.co.uk/ywww/images/topleft.gif\" alt=\"YourNextRead\"/>
+				<img src=\"../images/topleft.gif\" alt=\"YourNextRead\"/>
 				</noscript>";
 				if($iPhone && !$iPad)
 				{
@@ -283,10 +283,10 @@
 				echo $linkedRecommended . "</p>";
 				echo "<p>" . $vote . "</p>";
 				
-				echo "Change to <a href=\"http://test.markup.co.uk/ywww/de/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead Germany</a>, ";
-				echo "Change to <a href=\"http://test.markup.co.uk/ywww/ca/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead Canada</a>, ";
-				echo "Change to <a href=\"http://test.markup.co.uk/ywww/fr/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead France</a>, ";				
-				echo "Change to <a href=\"http://test.markup.co.uk/ywww/us/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead USA</a>";
+				echo "Change to <a href=\"../de/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead Germany</a>, ";
+				echo "Change to <a href=\"../ca/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead Canada</a>, ";
+				echo "Change to <a href=\"../fr/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead France</a>, ";				
+				echo "Change to <a href=\"../us/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead USA</a>";
 				echo ", See this on <a href=\"http://www.YourNextPresent.com/us/#!isbn=$isbn\">YourNextPresent</a>, ";
 				echo "Switch to <a href=\"http://www.YourNextFilm.com/us/\">YourNextFilm</a>, ";
 				echo "Switch to <a href=\"http://www.YourNextGame.com/us/\">YourNextGame</a>";
@@ -312,7 +312,7 @@
 			<li><a href=\"http://support.microsoft.com/gp/howtoscript\">Internet Explorer</a></li>
 			</ul>
 			<p>Thank you for using YourNextRead<p>
-			<img src=\"http://test.markup.co.uk/ywww/images/topleft.gif\" alt=\"YourNextRead\"/>
+			<img src=\"../images/topleft.gif\" alt=\"YourNextRead\"/>
 			</noscript>";
 			if($iPhone && !$iPad)
 			{