diff us/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 b058736bc9ad
children 38d209611508
line wrap: on
line diff
--- a/us/index.php	Sat Jan 05 06:21:12 2019 -0500
+++ b/us/index.php	Sat Jan 05 18:00:10 2019 -0500
@@ -1,6 +1,7 @@
 <?PHP
+include_once "dlog.php";
 session_start();
-  
+
 	function uniqueRand($n, $min = 0, $max = null)
 	{
 		if($max === null)
@@ -79,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://www.yournextread.com/images/topleft.gif\" alt=\"YourNextRead\"/>
+				<img src=\"http://test.markup.co.uk/ywww/images/topleft.gif\" alt=\"YourNextRead\"/>
 				</noscript>";
 				if($iPhone && !$iPad)
 				{
@@ -111,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://www.YourNextRead.com/us/#!isbn=$isbn>$bookTitle</a> ";
+						echo "<a href=http://test.markup.co.uk/ywww/us/#!isbn=$isbn>$bookTitle</a> ";
 					}
 				}		
 			}
@@ -146,8 +147,7 @@
 					if (preg_match("/<Error>/",$bookDetails)) {
 					  $resName=$bookXML->getName();
 					  $code=$bookXML->Error->Code;
-					  file_put_contents('/var/ywww/debug/phpDebug',"Losing 3: $resName, ".
-							    $code."\n",FILE_APPEND);
+					  dl("Losing 3: $resName, $code\n");
 					  if ($code=='RequestThrottled') {
 					    usleep(200000); // Try to reduce throttling until we get a 
 					    // principled solution in place
@@ -183,9 +183,7 @@
 				$xml = new SimpleXMLElement($linkedBooks);
 				}
 				catch (Exception $e) {
-				  file_put_contents('/var/ywww/debug/phpDebug',
-						    "Bad XML?: ".$linkedBooks,
-						    FILE_APPEND);
+				  dl("Bad XML?: ".$linkedBooks."\n");
 				  throw $e;
 				}
 				$recommended = "";
@@ -198,12 +196,7 @@
 				  $res = mysqli_query($link, $query) or exit( mysqli_error( $link ));
 				  set_error_handler(function () {
 				      global $bookLDetails, $linkedISBN;
-				      file_put_contents('/var/ywww/debug/phpDebug',
-							"Caught other one?: ".$linkedISBN,
-							FILE_APPEND);
-				      //file_put_contents('/var/ywww/debug/phpDebug',
-				      //		print_r($bookLDetails, TRUE)."\n",
-				      //		FILE_APPEND);
+				      dl("Caught other one?: $linkedISBN\n");
 				    } );
 				  if ( mysqli_num_rows( $res ) > 0 )
 				    {
@@ -221,8 +214,7 @@
 				      if (preg_match("/<Error>/",$bookLDetails)) {
 					$resName=$bookLXML->getName();
 					$code=$bookLXML->Error->Code;
-					file_put_contents('/var/ywww/debug/phpDebug',"Losing 2: $resName, ".
-							  $code."\n",FILE_APPEND);
+					dl("Losing 2: $resName, $code\n");
 					if ($code=='RequestThrottled') {
 					  usleep(200000); // Try to reduce throttling until we get a 
 					  // principled solution in place
@@ -253,7 +245,7 @@
 				      $recommended .= " $titleL by $authorL,";
 				      $underAuthor = str_replace(" ","_",$authorL);
 				      $underTitle = str_replace(" ","_",$titleL);
-				      $linkedRecommended .= "<a href=\"http://www.YourNextRead.com/us/#!isbn=$linkedISBN/$underTitle" . "_by_$authorL\">$titleL by $authorL</a>, ";		
+				      $linkedRecommended .= "<a href=\"http://test.markup.co.uk/ywww/us/#!isbn=$linkedISBN/$underTitle" . "_by_$authorL\">$titleL by $authorL</a>, ";		
 				    }					
 				}
 				
@@ -271,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://www.yournextread.com/images/topleft.gif\" alt=\"YourNextRead\"/>
+				<img src=\"http://test.markup.co.uk/ywww/images/topleft.gif\" alt=\"YourNextRead\"/>
 				</noscript>";
 				if($iPhone && !$iPad)
 				{
@@ -291,10 +283,10 @@
 				echo $linkedRecommended . "</p>";
 				echo "<p>" . $vote . "</p>";
 				
-				echo "Change to <a href=\"http://www.YourNextRead.com/de/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead Germany</a>, ";
-				echo "Change to <a href=\"http://www.YourNextRead.com/ca/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead Canada</a>, ";
-				echo "Change to <a href=\"http://www.YourNextRead.com/fr/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead France</a>, ";				
-				echo "Change to <a href=\"http://www.YourNextRead.com/us/#!isbn=$isbn/$title" . "_by_$author\">YourNextRead USA</a>";
+				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 ", 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>";
@@ -320,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://www.yournextread.com/images/topleft.gif\" alt=\"YourNextRead\"/>
+			<img src=\"http://test.markup.co.uk/ywww/images/topleft.gif\" alt=\"YourNextRead\"/>
 			</noscript>";
 			if($iPhone && !$iPad)
 			{