5) { $errorMessage = "Invalid rating."; } else { $statement = $connection->prepare("REPLACE INTO reviews ( `mod`, user, rating, review ) VALUES ( ?, ?, ?, ? );"); if (!$statement) { $errorMessage = "An unexpected error occurred while submitting the review."; } else { $statement->bind_param('iiis', $modData['id'], $_SESSION['user'], $rating, $_POST['review']); if (!$statement->execute()) { $errorMessage = "An unexpected error occurred while submitting the review."; } else { $reviewSubmitted = true; } } } } } elseif ($_POST['action'] == "delete") { $statement = $connection->prepare("DELETE FROM reviews WHERE `mod` = ? AND user = ?"); if (!$statement) { $errorMessage = "An unexpected error occurred while deleting the review."; } else { $statement->bind_param('ii', $modData['id'], $_SESSION['user']); if (!$statement->execute()) { $errorMessage = "An unexpected error occurred while deleting the review."; } else { $reviewDeleted = true; } } } else { $errorMessage = "Unknown action specified."; } } if ($reviewSubmitted) { $pageTitle = "Review submitted"; $pageDescription = "Your review has been submitted."; } elseif ($reviewDeleted) { $pageTitle = "Review deleted"; $pageDescription = "Your review has been deleted."; } else { $pageTitle = 'Reviews for "' . $modData['name'] . '" mod'; $pageDescription = 'See reviews for the "' . $modData['name'] . '" mod on SVR.JS Mods directory.'; $pageImage = (isset($modData['image_ext']) && $modData['image_ext'] ? 'mods/' . urlencode(str_replace(['/', '\\'], '', $modData['slug'])) . '.' . urlencode(str_replace(['/', '\\'], '', $modData['image_ext'])) : 'mod-missing.png'); } include 'header.php'; ?>

Review submitted

Your review has been submitted.

Return to mod reviews

Review deleted

Your review has been deleted.

Return to mod reviews

Reviews for “” mod

Return to the mod page

' . htmlspecialchars($errorMessage) . '

'; ?> '; echo '' . htmlspecialchars(number_format($modData['rating'], 2)) . ''; echo ''; for ($i = 0; $i < $stars; $i++) { echo ''; } for ($i = $stars; $i < 5; $i++) { echo ''; } echo '

'; } ?>

Reviews:

Submit a review

You need to be logged in to submit a review on this mod.

As a mod publisher, you cannot submit a review on this mod.

prepare('SELECT rating, review FROM reviews WHERE `mod` = ? AND user = ?;'); if ($statement) { $statement->bind_param('ii', $modData['id'], $_SESSION['user']); $statement->execute(); $result = $statement->get_result(); if ($result) { $userReview = $result->fetch_assoc(); } $statement->close(); } ?>
Rating: > > > > >

Delete your review

Reviews

prepare('SELECT COUNT(reviews.id) AS count FROM reviews JOIN ( SELECT mods.id AS id, mods.is_removed AS is_removed, mods.name AS name, mods.slug AS slug FROM mods JOIN users ON users.id = mods.user AND users.is_verified = 1 AND users.is_deleted = 0 AND users.is_suspended = 0 ) AS mods ON mods.id = reviews.mod JOIN users ON users.id = reviews.user WHERE mods.id = ? AND mods.is_removed = 0 AND users.is_suspended = 0 AND users.is_deleted = 0 AND users.is_verified = 1;'); if (!$countStatement) { echo "

An unexpected error occurred while fetching reviews.

"; } else { $countStatement->bind_param('i', $modData['id']); $countStatement->execute(); $countResult = $countStatement->get_result(); if (!$countResult) { echo "

An unexpected error occurred while fetching reviews.

"; $countStatement->close(); } else { $countRow = $countResult->fetch_assoc(); $countStatement->close(); if (!$countRow) { echo "

An unexpected error occurred while fetching reviews.

"; } else { $modCount = $countRow['count']; $totalPages = ceil($modCount / PAGE_MODS); $statement = $connection->prepare('SELECT reviews.id AS id, reviews.rating AS rating, reviews.review AS review, mods.name AS mod_name, mods.slug AS mod_slug, users.username AS user, users.id AS user_id FROM reviews JOIN ( SELECT mods.id AS id, mods.is_removed AS is_removed, mods.name AS name, mods.slug AS slug FROM mods JOIN users ON users.id = mods.user AND users.is_verified = 1 AND users.is_deleted = 0 AND users.is_suspended = 0 ) AS mods ON mods.id = reviews.mod JOIN users ON users.id = reviews.user WHERE mods.id = ? AND mods.is_removed = 0 AND users.is_suspended = 0 AND users.is_deleted = 0 AND users.is_verified = 1 ORDER BY reviews.id DESC LIMIT ?,?;'); if (!$statement) { echo "

An unexpected error occurred while fetching reviews.

"; } else { $pageNumber = isset($_GET['page']) && filter_var($_GET['page'], FILTER_VALIDATE_INT) ? intval($_GET['page']) : 1; $firstNumber = PAGE_REVIEWS * ($pageNumber - 1); $pageReviews = PAGE_REVIEWS; $statement->bind_param('iii', $modData['id'], $firstNumber, $pageReviews); $statement->execute(); $result = $statement->get_result(); if (!$result) { echo "

An unexpected error occurred while fetching reviews.

"; $statement->close(); } else { $reviewsPresent = false; while ($review = $result->fetch_assoc()) { $reviewsPresent = true; echo '
'; $stars = round($review['rating']); echo ''; for ($i = 0; $i < $stars; $i++) { echo ''; } for ($i = $stars; $i < 5; $i++) { echo ''; } echo ' | by ' . htmlspecialchars($review['user']) . ' | on ' . htmlspecialchars($review['mod_name']) . '

' . str_replace(["\r\n", "\n", "\r"], '
', htmlspecialchars($review['review'])) . '

'; } if (!$reviewsPresent) { echo '

No reviews.

'; } $statement->close(); if ($totalPages > 1) { $begPage = $pageNumber - 2; $endPage = $pageNumber + 2; if ($endPage > $totalPages) { $begPage -= $endPage - $totalPages; $endPage = $totalPages; } if ($begPage < 1) { $endPage += 1 - $begPage; $begPage = 1; } echo ''; } } } } } } ?>
prepare('SELECT username FROM users WHERE id = ?;'); if ($usernameStatement) { $usernameStatement->bind_param('i', $_SESSION['user']); $usernameStatement->execute(); $usernameResult = $usernameStatement->get_result(); if ($usernameResult) { $usernameRow = $usernameResult->fetch_assoc(); if ($usernameRow) { $username = $usernameRow['username']; } } $usernameStatement->close(); } } sendEmail( [[ "name" => $modData['user'], "address" => $modData['user_email'] ]], ($username ? $username : 'Someone') . ' has left a review on your mod', ($username ? $username : 'Someone') . " has left you a " . intval($_POST['rating']) . "-star review on your \"" . $modData['name'] . "\" mod. The contents of the review are below:\n\n" . $_POST['review'] ); } ?>