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