<?php //shows the bookcp page of the book copy specified by the ?bcid include 'models/show_book_functions.php'; include 'models/show_bookcp_functions.php'; include 'models/comment_functions.php'; include 'models/connect.php'; require 'models/redirect.php'; require 'models/date.php'; //if get bcid not set redirects to index if (isset($_GET['bcid'])) { //if bcid does not exist redirects to 404 page if ($bcopy = getBcopyDetails($_GET['bcid'])) { $title = $bcopy['title']; $book = getBookDetails($bcopy['bid']); $comments = getBcopyComments($_GET['bcid']); $showHeading = false; require 'views/header.php'; require 'views/book_cp/book_cp.php'; require 'views/footer.php'; } else { standardRedirect('Location: 404.php'); } } else { standardRedirect('Location: index.php'); } ?>
<?php require 'models/connect.php'; require 'models/transactions.php'; require 'models/redirect.php'; require 'models/show_bookcp_functions.php'; if (!isset($_SESSION['userid'])) { standardRedirect('login.php', ['red' => 'request'], ['bcid']); } if (empty($_GET['bcid'])) { standardRedirect('index.php'); } if (($book = getBcopyDetails($_GET['bcid'])) === false) { standardRedirect('index.php'); } if (false) { //!hasRequested( $_GET[ 'receiverid' ], $_GET[ 'bcid' ] ) ) { $result = 'Ο χρήστης δε σας ζήτησε ποτέ αυτό το βιβλίο.'; } else { if ($book['owner']['uid'] != $_SESSION['userid']) { $result = 'Αυτό το αντίτυπο δεν ανήκει σε εσάς. Δεν μπορείτε να το δώσετε σε άλλο χρήστη'; } else { if ($book['given']) { $result = 'To βιβλίο έχει δοθεί ήδη.'; } else { if (giveBook($_GET['receiverid'], $_GET['bcid'])) { $message = 'Ευχαριστούμε που δώσατε το βιβλίο στο χρήστη'; } else { $message = 'Κάτι πήγε στραβά'; } }
require "models/connect.php"; require "models/comment_functions.php"; require "models/user_functions.php"; require "models/show_book_functions.php"; require "models/show_bookcp_functions.php"; //if seesion isn't set redirects to login page if (!isset($_SESSION)) { header("Location: login.php"); die; } if (isset($_GET['uid'])) { // if a comment is submited and profile id is valid add comment //get uid represent the profile the commint is put on if (!empty($_POST['comment'] && getUserData($_GET['uid']))) { $success = addProfileComment($_POST['comment'], $_SESSION['userid'], $_GET['uid']); //redirects back to profile page header("Location: profiler.php" . "?uid=" . $_GET['uid']); die; } } if (isset($_GET['bcid'])) { if (!empty($_POST['comment'] && getBcopyDetails($_GET['bcid']))) { $success = addBookComment($_POST['comment'], $_SESSION['userid'], $_GET['bcid']); //redirects back to bcopy page header("Location: bookcp.php" . "?bcid=" . $_GET['bcid']); die; } } header("Location: index.php"); die;