comparison us/index.php @ 49:a67bf725e87b

put both paths in include_path and depend on that
author Charlie Root
date Wed, 16 Jan 2019 13:42:15 -0500
parents da133c130c1d
children
comparison
equal deleted inserted replaced
48:da133c130c1d 49:a67bf725e87b
1 <?PHP 1 <?PHP
2 include_once "ywww/dlog.php"; 2 include_once "dlog.php";
3 3
4 session_start(); 4 session_start();
5 5
6 function uniqueRand($n, $min = 0, $max = null) 6 function uniqueRand($n, $min = 0, $max = null)
7 { 7 {
13 foreach($keys as $key) 13 foreach($keys as $key)
14 $return[] = $array[$key]; 14 $return[] = $array[$key];
15 return $return; 15 return $return;
16 } 16 }
17 17
18 include "ywww/mdetect.php"; 18 include "mdetect.php";
19 $uagent_obj = new uagent_info(); 19 $uagent_obj = new uagent_info();
20 $iPhone = $uagent_obj->DetectSmartphone(); 20 $iPhone = $uagent_obj->DetectSmartphone();
21 $iPad = $uagent_obj->DetectIpad(); 21 $iPad = $uagent_obj->DetectIpad();
22 22
23 $proceed = true; 23 $proceed = true;
28 { 28 {
29 $pos = strpos($_SERVER['HTTP_REFERER'], "apps.facebook.com"); 29 $pos = strpos($_SERVER['HTTP_REFERER'], "apps.facebook.com");
30 if($pos !== false || isset($_GET['facebook'])) 30 if($pos !== false || isset($_GET['facebook']))
31 { 31 {
32 //we are in facebook canvas so react appropriately 32 //we are in facebook canvas so react appropriately
33 include_once 'ywww/facebook.php'; 33 include_once 'facebook.php';
34 34
35 $facebook = new Facebook(array( 35 $facebook = new Facebook(array(
36 'appId' => '128245333876633', 36 'appId' => '128245333876633',
37 'secret' => 'f51afc7e04289db62448edd8b70d83bf', 37 'secret' => 'f51afc7e04289db62448edd8b70d83bf',
38 'cookie' => true, 38 'cookie' => true,
98 //we are at the launch page 98 //we are at the launch page
99 echo "<p>Get started, search for a book you like... or choose from one of the lists below:</p><BR></BR>"; 99 echo "<p>Get started, search for a book you like... or choose from one of the lists below:</p><BR></BR>";
100 100
101 $ret = 1; 101 $ret = 1;
102 102
103 $bookLists = include "ywww/php/read/getAllSavedBooks.php"; 103 $bookLists = include "php/read/getAllSavedBooks.php";
104 $xml = new SimpleXMLElement($bookLists); 104 $xml = new SimpleXMLElement($bookLists);
105 105
106 $numOfLists = sizeof($xml->List) - 1; //-1 for zero indexing 106 $numOfLists = sizeof($xml->List) - 1; //-1 for zero indexing
107 107
108 $randomFourLists = uniqueRand(4,0,$numOfLists); 108 $randomFourLists = uniqueRand(4,0,$numOfLists);
124 $chars = explode("/",$isbn); 124 $chars = explode("/",$isbn);
125 $isbn = $chars[0]; 125 $isbn = $chars[0];
126 $ret = 1; 126 $ret = 1;
127 $countryCode = 0; 127 $countryCode = 0;
128 128
129 include "private/db.php"; 129 include "db.php";
130 $query = "CALL b_getBookInfo('$isbn', $countryCode)"; 130 $query = "CALL b_getBookInfo('$isbn', $countryCode)";
131 //echo $query; 131 //echo $query;
132 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); 132 $res = mysqli_query($link, $query) or exit( mysqli_error( $link ));
133 include "ywww/xml/aws_signed_request.php"; 133 include "xml/aws_signed_request.php";
134 include "ywww/xml/getAmazonInfo.php"; 134 include "xml/getAmazonInfo.php";
135 if ( mysqli_num_rows( $res ) > 0 ) 135 if ( mysqli_num_rows( $res ) > 0 )
136 { 136 {
137 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC); 137 $rows=mysqli_fetch_array($res, MYSQLI_ASSOC);
138 mysqli_close($link); 138 mysqli_close($link);
139 $title = $rows["Title"]; 139 $title = $rows["Title"];
177 $author = "[no Author]"; 177 $author = "[no Author]";
178 } 178 }
179 } 179 }
180 } 180 }
181 181
182 $linkedBooks = include "ywww/php/read/getLinkedBooks.php"; 182 $linkedBooks = include "php/read/getLinkedBooks.php";
183 try { 183 try {
184 $xml = new SimpleXMLElement($linkedBooks); 184 $xml = new SimpleXMLElement($linkedBooks);
185 } 185 }
186 catch (Exception $e) { 186 catch (Exception $e) {
187 dl("Bad XML?: ".$linkedBooks."\n"); 187 dl("Bad XML?: ".$linkedBooks."\n");
189 } 189 }
190 $recommended = ""; 190 $recommended = "";
191 $linkedRecommended = ""; 191 $linkedRecommended = "";
192 for($i=0;$i<sizeof($xml->isbn);$i++){ 192 for($i=0;$i<sizeof($xml->isbn);$i++){
193 $linkedISBN = $xml->isbn[$i]; 193 $linkedISBN = $xml->isbn[$i];
194 include "private/db.php"; 194 include "db.php";
195 $query = "CALL b_getBookInfo('$linkedISBN', $countryCode)"; 195 $query = "CALL b_getBookInfo('$linkedISBN', $countryCode)";
196 //echo $query; 196 //echo $query;
197 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); 197 $res = mysqli_query($link, $query) or exit( mysqli_error( $link ));
198 set_error_handler(function () { 198 set_error_handler(function () {
199 global $bookLDetails, $linkedISBN; 199 global $bookLDetails, $linkedISBN;