Mercurial > hg > ywww
comparison de/index.php @ 19:84a412b8122c
try to protect against a range of missing info
author | Charlie Root |
---|---|
date | Thu, 30 Aug 2018 17:18:12 -0400 |
parents | 077b0a0a3e6d |
children | a67bf725e87b |
comparison
equal
deleted
inserted
replaced
18:c41a5802b26c | 19:84a412b8122c |
---|---|
122 $chars = explode("/",$isbn); | 122 $chars = explode("/",$isbn); |
123 $isbn = $chars[0]; | 123 $isbn = $chars[0]; |
124 $ret = 1; | 124 $ret = 1; |
125 $countryCode = 3; | 125 $countryCode = 3; |
126 | 126 |
127 include "../../private/db.php"; | 127 include "../../private/db.php"; |
128 $query = "CALL b_getBookInfo('$isbn', $countryCode)"; | 128 $query = "CALL b_getBookInfo('$isbn', $countryCode)"; |
129 //echo $query; | 129 //echo $query; |
130 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); | 130 $res = mysqli_query($link, $query) or exit( mysqli_error( $link )); |
131 include "../xml/aws_signed_request.php"; | 131 include "../xml/aws_signed_request.php"; |
132 include "../xml/getAmazonInfo.php"; | 132 include "../xml/getAmazonInfo.php"; |
136 $title = $rows["Title"]; | 136 $title = $rows["Title"]; |
137 $author = $rows["Author"]; | 137 $author = $rows["Author"]; |
138 } | 138 } |
139 else | 139 else |
140 { | 140 { |
141 $bookDetails = getAmazonDet($isbn,1,'ca'); | 141 $bookDetails = getAmazonDet($isbn,1,'de'); |
142 $bookXML = new SimpleXMLElement($bookDetails); | 142 $bookXML = new SimpleXMLElement($bookDetails); |
143 $title = $bookXML->Items->Item[0]->ItemAttributes->Title; | 143 if ($bookXML->Items && $bookXML->Items->Item[0] && |
144 $author = $bookXML->Items->Item[0]->ItemAttributes->Author; | 144 $bookXML->Items->Item[0]->ItemAttributes) |
145 { $attrs=$bookXML->Items->Item[0]->ItemAttributes; | |
146 if ($attrs->Title) { | |
147 $title = $attrs->Title; } | |
148 else { | |
149 $title ="[no Title]"; | |
150 } | |
151 if ($attrs->Author) { | |
152 $author = $attrs->Author; | |
153 } | |
154 else { | |
155 $author ="[no Author]"; | |
156 } | |
157 } | |
158 else { | |
159 $title ="[no Title]"; | |
160 $author = "[no Author]"; | |
161 } | |
145 } | 162 } |
146 | 163 |
147 $linkedBooks = include "../php/read/getLinkedBooks.php"; | 164 $linkedBooks = include "../php/read/getLinkedBooks.php"; |
148 $xml = new SimpleXMLElement($linkedBooks); | 165 $xml = new SimpleXMLElement($linkedBooks); |
149 | 166 |
164 } | 181 } |
165 else | 182 else |
166 { | 183 { |
167 $bookLDetails = getAmazonDet($linkedISBN,1,'de'); | 184 $bookLDetails = getAmazonDet($linkedISBN,1,'de'); |
168 $bookLXML = new SimpleXMLElement($bookLDetails); | 185 $bookLXML = new SimpleXMLElement($bookLDetails); |
169 $titleL = $bookLXML->Items->Item[0]->ItemAttributes->Title; | 186 if ($bookLXML->Items && |
170 $authorL = $bookLXML->Items->Item[0]->ItemAttributes->Author; | 187 $bookLXML->Items->Item[0] && |
188 $bookLXML->Items->Item[0]->ItemAttributes) { | |
189 $attrs=$bookLXML->Items->Item[0]->ItemAttributes; | |
190 if ($attrs->Title) { | |
191 $titleL = $attrs->Title; } | |
192 else { | |
193 $titleL = ""; } | |
194 if ($attrs->Author) { | |
195 $authorL = $attrs->Author; } | |
196 else { | |
197 $authorL = ""; } | |
198 } | |
199 else { | |
200 $titleL = ""; } | |
171 } | 201 } |
172 if($titleL != "") | 202 if($titleL != "") |
173 { | 203 { |
174 $recommended .= " $titleL by $authorL,"; | 204 $recommended .= " $titleL by $authorL,"; |
175 $underAuthor = str_replace(" ","_",$authorL); | 205 $underAuthor = str_replace(" ","_",$authorL); |
271 var obj = new Object; | 301 var obj = new Object; |
272 obj.height=960; | 302 obj.height=960; |
273 FB.Canvas.setSize(obj); | 303 FB.Canvas.setSize(obj); |
274 </script>"; | 304 </script>"; |
275 } | 305 } |
276 } | 306 } |
277 ?> | 307 ?> |
278 | 308 |
279 <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> | 309 <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> |
280 | 310 |
281 <script type="text/javascript"> | 311 <script type="text/javascript"> |