$result['shelfID'] = $books[$i]['shelfID']; $deliver[] = $result; } else { j_die($error['only_one_action_allowed']); } } else { //Book shall be lended //Check if user has been set if ($user === -1) { j_die($error['no_user_rfid']); } if ($res['type'] !== "deliver") { $res['type'] = 'lend'; require ROOT . 'admin/info.class.php'; $info = new Info("books", $books[$i]['bookID']); $result = $info->getInfo(); $result['RFID'] = $books[$i]['rfid']; $result['shelfID'] = $books[$i]['shelfID']; $lend[] = array('user' => $user, 'date' => $date, 'book' => $result); } else { j_die($error['only_one_action_allowed']); } } } //Lend shiet for ($i = 0; $i < count($lend); $i++) { $insert_user_book = "INSERT INTO lib_User_Book (userID, outDate, bookRFID, deliver_deadline) VALUES \n ('" . $lend[$i]['user'] . "', '" . $lend[$i]['date'] . "', '" . $lend[$i]['book']['RFID'] . "', '" . $deliver_deadline . "')"; $insert_user_book_qry = $conn->query($insert_user_book); if ($insert_user_book_qry === TRUE) { //Success $res['status'][] = array('book_info' => get_book_info($lend[$i]['book'], $deliver_deadline), 'error' => $error['lend_success']);
echo DEPENDENCIES_LOC; ?> imgs/cross.png" /></a> </div> <div id="footnotes" class="bottom_right"> <img src="<?php echo DEPENDENCIES_LOC; ?> imgs/soke_p.png" /> </div> <?php } else { if (isset($_GET['book'])) { require ROOT . 'admin/info.class.php'; $info = new Info("books", $_GET['book']); $i = $info->getInfo(); $author = $i['author']; if (count(explode(",", $author)) > 1) { $author = explode(",", $author)[1] . " " . explode(",", $author)[0]; } ?> <style> body{ background-color: #e3ba26; } h2{ margin-bottom: 5px; line-height: 36px; } #text{ margin-top: 140px;
} } echo '</tr>'; } echo '</tbody></table>'; } else { echo 'Ukjent.'; } } } else { if ($index_a[0] == "info") { //Book if (isset($index_a[1]) && isset($index_a[2])) { require 'info.class.php'; $information = new Info($index_a[1], $index_a[2]); $info = $information->getInfo(); if ($info != false) { print_info($info); } else { echo $info->error; } } else { echo "Mangler data :/"; } } else { if ($index_a[0] == "create") { if (isset($index_a[1])) { $fields = array('book' => array('verifyer' => 'title'), 'user' => array('verifyer' => 'firstname'), 'shelf' => array('verifyer' => 'name')); if (isset($fields[$index_a[1]])) { if (isset($_POST[$fields[$index_a[1]]['verifyer']])) { //Fix the birth