$ $item) { if(array_key_exists($key,$deleted)){unset($books[$key]);} } if(isset($_GET['favs']) and $user!=="guest") { $dislikes=array(); foreach($likes as $key => $like) {if($like[2]!==$_GET['favs'] or substr($like[0],0,4)!==$itemtype) {unset($likes[$key]);} if($like[1]==0){array_push($dislikes,$like);} } array_diff($likes,$dislikes); echo "

" . $_GET['favs'] . "'s favorite books

"; if(sizeof($likes)<1){echo "There are currently no books on this list. Back to the bookstore.
";} foreach($likes as $like) { echo "" . $books[$like[0]]["; } } elseif(isset($_GET['type'])) { if($_GET['type']=="latest") {$books=array_slice($books, 0, 12); $name="Recent Additions"; } else{ foreach($books as $key=>$item) if($item['type']!==$_GET['type']) unset($books[$key]); $name="Books About " . $categories[$_GET['type']]['title'];} echo "

" . $name . "

"; if($_GET['type']!=="latest"){echo "Our selection of books about " . $categories[$_GET['type']]['description'] . "

";} echo "
"; foreach ($books as $key => $item) { echo "" . $item["; } echo "
"; } elseif(isset($_GET['item'])) { if($_GET['item']=="error") {echo "Sorry, we couldn't add this book to our database. You can try again, checking if you're entering correct ISBN-10.";} elseif($_GET['item']=="new") {echo "

Add a book

"; if($user!=="mod" and $user!=="keyholder"){echo "Sorry, you need keys to add a book to our bookstore.";} else {echo "
To add a book to Fort bookstore, you need to know its ISBN-10 number. Look up ISBN.




"; }} else{ if(!array_key_exists($_GET['item'],$books)){echo "Sorry, we're not finding the book you're looking for. Back to the bookstore
";} else{ $item=$books[$_GET['item']]; echo "

Books About Abuse and Mental Health

"; echo "
\"\"" . $item['title'] . ""; if($item['title2']!==""){echo "
" . $item['title2'];} echo "
by " . $item['author'] . "

" . $item['description'] . "

Amazon\"\" AbeBooks Libraries

"; if($user!=="guest") { $likesstring=""; $myfav="no"; $itemid = "book" . $item['isbn']; $content = str_replace("
", "\n", $item['title']) . " by " . $item['author']; $dislikes=array(); foreach($likes as $key => $like) {if($like[0]!==$itemid){unset($likes[$key]);} elseif($like[1]==0){array_push($dislikes,$like);}} $likes=array_diff($likes,$dislikes); unset($like); if(sizeof($likes)>0) {foreach($likes as $like){if($like[2]==$username){$item['myfav']="yes";} $likesstring.= $like[2] . ", ";} $likesstring=substr($likesstring, 0, -2);} include("form-report-delete-like.php"); echo $reportlikedelete; if($likesstring!=="") {echo "
Other books about " . $categories[$item['type']]['title'] . ":
"; foreach($books as $key=>$book) if($book['type']==$item['type'] and $book['isbn']!==$item['isbn']) { echo "" . $book["; } echo ""; }}} else { $item=array_slice($books, 0, 12); shuffle($item); $item=$item[0]; echo "

Books About Abuse and Mental Health

"; echo "
\"\"Featured book:
" . $item['title'] . ""; if($item['title2']!==""){echo "
" . $item['title2'];} echo "
by " . $item['author'] . "

" . $item['description'] . "

Amazon\"\" AbeBooks Libraries

"; if($user!=="guest") { $itemid = "book" . $item['isbn']; $content = str_replace("
", "\n", $item['title']) . " by " . $item['author']; $likesstring=""; $myfav="no"; $itemid = "book" . $item['isbn']; $content = str_replace("
", "\n", $item['title']) . " by " . $item['author']; $dislikes=array(); foreach($likes as $key => $like) {if($like[0]!==$itemid){unset($likes[$key]);} elseif($like[1]==0){array_push($dislikes,$like);}} $likes=array_diff($likes,$dislikes); unset($like); if(sizeof($likes)>0) {foreach($likes as $like){if($like[2]==$username){$item['myfav']="yes";} $likesstring.= $like[2] . ", ";} $likesstring=substr($likesstring, 0, -2);} include("form-report-delete-like.php"); echo $reportlikedelete; if($likesstring!=="") {echo "
Recent Additions:
"; /* */ //echo "
"; } echo ""; echo ""; ?>