请修复这段代码。这就是它所说的“解析错误:语法错误,第 49 行 /home/timmycpc/public_html/ItemDatabase/index.php 中的意外 T_STRING”这是第 12 - 49 行:
<?php
$arr = json_decode(file_get_contents("url.com/file.json"),true);
$page = isset($_GET['p']) ? intval($_GET['p']) : 0;
$elementsPerPage = 20;
$elements = array_slice($arr, $page * $elementsPerPage, $elementsPerPage);
$totalpages = intval(count($arr)/$elementsPerPage);
if($_GET['p'] == ""){$_GET['p'] = '0';}
$whatpage = $_GET['p'];
if($whatpage > $totalpages){echo("<tr><td>Sorry this page does not exist. Please return to <a href='?p=0'>page 1</a>.</td></tr>"); exit;}
$link1 = $whatpage-1;
$link2 = $whatpage+1;
if($_GET['p'] == 0){$backbutton = "";} else {$backbutton = "<a href=?p=" . $link1 . ">Previous Page</a>";}
if($_GET['p'] == $totalpages){$nextbutton = "";} else {$nextbutton = "<a href=?p=" . $link2 . ">Next Page</a>";}
if($_GET['p'] == $totalpages or $_GET['p'] == 0){$middle = "";} else {$middle = " | ";}
$pagenav = $backbutton . $middle . $nextbutton;
echo('<tr><td colspan="5" align="center">'.$pagenav.'</td></tr>');
foreach($elements as $item)
{
$label = $item['label'];
$cost = $item['cost'];
$id = $item['paper_item_id'];
$member = $item['is_member'];
$patched = $item['is_bait'];
if ($member == "1") {
$member = "Yes";
}else{
$member = "No";
}
if ($patched == "1") {
$patched = "Yes";
}else{
$patched = "No";
}
$str .= "<tr><td><embed src="http://www.url.com/SWFViewer/items.swf?id=<?php echo($id); ?>"></td><td style='text-align: left !important;'><b>Name:</b> $label</td><td><b>Item ID:</b> $id</td><td><b>Members:</b> $member</td><td><b>Cost:</b> $cost coins</td><td><b>Patched:</b> $patched</td></tr>";
}
echo substr($str, 0, -5);
?></table></center></body></html>