Mercurial > hg > ywww
view php/read/map/getMapISBNCirclePaths.php @ 51:e6976d92cfc9
refactor 503
author | Charlie Root |
---|---|
date | Thu, 06 Jun 2019 16:32:56 -0400 |
parents | a67bf725e87b |
children |
line wrap: on
line source
<?PHP if(!isset($ret)) { header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); } $linkedBooks = 0; //$isbn = $_GET['isbn']; $UserID = $_GET['user']; if(isset($_GET['loc'])){ $loc = $_GET['loc']; } else{ $loc = 0; //default location is 1 } if(isset($_GET['listname'])){ $listName = $_GET['listname']; } else{ $listName = "MyMap"; //default location is 1 } include "db.php"; $query = "CALL b_getMapUserList('$UserID',$loc, \"$listName\")"; // this generates fixed points - //echo $query; $results = mysqli_query($link, $query) or exit( mysqli_error( $link )); $output = "<?xml version=\"1.0\"?>"; $output .= "<results>"; //$output .= "<BookList>"; $LastNode = "START"; $ChangeNode = 0; while($line = mysqli_fetch_assoc($results)) { $ISBN =trim($line["ISBN"]); $Title = htmlspecialchars($line["BookTitle"]); $ImageURL = htmlspecialchars($line["PictureURL"]); $SuperNode = htmlspecialchars($line["SuperNode"]); IF ($LastNode != $SuperNode && $ChangeNode == 1) { $output .= "</BOOKS>"; $output .= "</SNode>"; $ChangeNode = 0; } IF ($LastNode != $SuperNode ) { $ChangeNode = 1; $output .= "<SNode>"; $output .= "<SuperNode>" . $SuperNode . "</SuperNode>"; $output .= "<BOOKS>"; } $output .= "<Book>"; $output .= "<ISBN>" . $ISBN . "</ISBN>"; $output .= "<Title>" . $Title . "</Title>"; $output .= "<ImageURL>" . $ImageURL . "</ImageURL>"; $output .= "</Book>"; $LastNode = $SuperNode; } $output .= "</BOOKS>"; $output .= "</SNode>"; //$output .= "</BookList>"; mysqli_close($link); include "db.php"; $query = "CALL b_getMap_isbnPaths('$UserID', $loc, \"$listName\")"; // this generates fixed points - //echo $query; $results = mysqli_query($link, $query) or exit( mysqli_error( $link )); $LastISBN = "START"; $ChangePaths = 0; while($line = mysqli_fetch_assoc($results)) { //$SuperNodeID = $line["SuperNodeID"]; HST commented out as was often // missing, so throwing error, and not actually used... $ISBN =trim($line["ISBN"]); //$Title = htmlspecialchars($line["BookTitle"]); //$ImageURL = htmlspecialchars($line["PictureURL"]); $ISBN2 =trim($line["ISBN2"]); $LinkID =trim($line["LinkID"]); IF ($LastISBN != $ISBN && $ChangePaths == 1) { $output .= "</PATHS>"; $output .= "</Node>"; $ChangePaths = 0; } IF ($LastISBN != $ISBN ) { $ChangePaths = 1; $output .= "<Node>"; $output .= "<ISBN>" . $ISBN . "</ISBN>"; $output .= "<PATHS>"; } $output .= "<LittleNode>"; $output .= "<ISBN2>" . $ISBN2 . "</ISBN2>"; $output .= "<LinkID>" . $LinkID . "</LinkID>"; $output .= "</LittleNode>"; $LastISBN = $ISBN; } $output .= "</PATHS>"; $output .= "</Node>"; $output .= "</results>"; echo $output; mysqli_close($link); ?>