Mercurial > hg > ywww
comparison php/read/getLinkedBooks.php @ 6:077b0a0a3e6d
remaining originals according to dependency walk
author | Robert Boland <robert@markup.co.uk> |
---|---|
date | Thu, 16 Feb 2017 22:29:02 +0000 |
parents | |
children | 385ddd7c4b55 b7376319d25a |
comparison
equal
deleted
inserted
replaced
5:55445b456ad0 | 6:077b0a0a3e6d |
---|---|
1 <?PHP | |
2 if(!isset($ret)) | |
3 { | |
4 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); | |
5 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | |
6 header("Cache-Control: no-store, no-cache, must-revalidate"); | |
7 header("Cache-Control: post-check=0, pre-check=0", false); | |
8 header("Pragma: no-cache"); | |
9 } | |
10 $linkedBooks = 0; | |
11 include "similar.php"; | |
12 | |
13 //$isbn = $_GET['isbn']; | |
14 | |
15 if(isset($_GET['isbn'])){ | |
16 $isbn = $_GET['isbn']; | |
17 } | |
18 | |
19 if(isset($_GET['loc'])){ | |
20 $loc = $_GET['loc']; | |
21 } | |
22 else{ | |
23 $loc = 1; //default location is 1 | |
24 } | |
25 | |
26 if(isset($ret)) | |
27 { | |
28 include "../../private/db.php"; | |
29 $loc = $countryCode; //passed from index.php when googlebot is crawling | |
30 } | |
31 else | |
32 { | |
33 include "../../../private/db.php"; | |
34 $ret = 0; | |
35 } | |
36 | |
37 $query = "CALL b_getLinksForISBN('$isbn',$loc)"; | |
38 //echo $query; | |
39 $results = mysqli_query($link, $query) or exit( mysqli_error( $link )); | |
40 | |
41 $output = "<?xml version=\"1.0\"?>"; | |
42 $output .= "<results>"; | |
43 | |
44 while($line = mysqli_fetch_assoc($results)) { | |
45 | |
46 $linkID = $line["LinkID"]; | |
47 $lISBN=trim($line["LinkedISBN"]); | |
48 $lID = trim($line["LinkID"]); | |
49 if($lISBN != "" && $lID != "") | |
50 { | |
51 $output .= "<type>0</type>"; | |
52 $output .= "<isbn>" . $lISBN . "</isbn>"; | |
53 $output .= "<linkID>" . $lID . "</linkID>"; | |
54 /*$output .= "<pos>" . $pos . "</pos>"; | |
55 $output .= "<search>" . $search . "</search>";*/ | |
56 $linkedBooks++; | |
57 } | |
58 /*else{ //this should never happen-> if there is a link, there must be a link ID and also an ISBN to link to | |
59 echo "**ERROR**" | |
60 echo "LinkedISBN=$lISBN"; //uncomment this to help debug if this ever happens. | |
61 echo "LinkID=$lID"; | |
62 }*/ | |
63 } | |
64 | |
65 if( $linkedBooks < 8 ) | |
66 { | |
67 $amazonBooks=addAmazonSimilarBooks($isbn,$loc,$ret); | |
68 $output .= $amazonBooks; | |
69 } | |
70 | |
71 $output .= "</results>"; | |
72 | |
73 if($ret==1) | |
74 return $output; | |
75 else | |
76 echo $output; | |
77 | |
78 mysqli_close($link); | |
79 | |
80 ?> |