🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:submit-review.php
<?php require_once __DIR__ . '/../includes/config.php'; require_once __DIR__ . '/../includes/db.php'; require_once __DIR__ . '/../includes/functions.php'; $page = 'review'; require_once '../includes/header.php'; require_once '../includes/navbar.php'; if (!is_logged_in() || $_SERVER['REQUEST_METHOD'] != 'POST') { header('Location: ' . SITE_URL); exit; } $product_id = intval($_POST['product_id']); $rating = intval($_POST['rating']); $title = trim($_POST['title'] ?? ''); $review_text = trim($_POST['review'] ?? ''); $user = get_user_data(); if ($product_id && $rating >= 1 && $rating <= 5 && $review_text) { $stmt = $db->prepare("INSERT INTO reviews (product_id, user_id, name, email, rating, title, review, status) VALUES (?, ?, ?, ?, ?, ?, ?, 0)"); $stmt->execute([$product_id, $_SESSION['user_id'], $user['first_name'] . ' ' . $user['last_name'], $user['email'], $rating, $title, $review_text]); set_flash('success', 'Thank you! Your review is awaiting approval.'); } $product = $db->prepare("SELECT slug FROM products WHERE id = ?"); $product->execute([$product_id]); $product = $product->fetch(); if ($product) { header('Location: ' . SITE_URL . 'pages/product.php?slug=' . $product['slug']); } else { header('Location: ' . SITE_URL); } exit;
Save Changes
Cancel
Create New File
Create New Folder