Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
prepare("SELECT * FROM dramas WHERE id = ?");
$stmt->execute([$drama_id]);
$drama = $stmt->fetch();
if (!$drama) {
header("Location: dashboard.php");
exit();
}
// 2. CHECK IF ALREADY RATED
$check = $pdo->prepare("SELECT id FROM production_ratings WHERE user_id = ? AND drama_id = ?");
$check->execute([$user_id, $drama_id]);
if ($check->fetch()) {
header("Location: dashboard.php?error=already_rated");
exit();
}
// 3. FETCH DYNAMIC PARAMETERS FROM SETTINGS
$params = $pdo->query("SELECT * FROM rating_parameters ORDER BY id ASC")->fetchAll();
// 4. HANDLE SUBMISSION
if (isset($_POST['submit_overall_rating'])) {
$param_scores = $_POST['param_scores'];
$comments = htmlspecialchars($_POST['comments']);
// --- SERVER-SIDE VALIDATION ---
foreach ($param_scores as $p_id => $p_score) {
$stmt_check = $pdo->prepare("SELECT max_marks, parameter_name FROM rating_parameters WHERE id = ?");
$stmt_check->execute([(int)$p_id]);
$p_data = $stmt_check->fetch();
if ($p_score > $p_data['max_marks']) {
die("FATAL ERROR: Marks for '" . $p_data['parameter_name'] . "' exceed the limit.");
}
}
$total_score = array_sum($param_scores);
// --- Capture Watch Time Snapshot ---
$time_stmt = $pdo->prepare("SELECT SUM(watch_time_seconds) FROM watch_logs WHERE user_id = ? AND drama_id = ?");
$time_stmt->execute([$user_id, $drama_id]);
$watch_time_snapshot = (int)$time_stmt->fetchColumn();
try {
$pdo->beginTransaction();
$stmt = $pdo->prepare("INSERT INTO production_ratings (user_id, drama_id, total_score, watch_time_at_submission, comments) VALUES (?, ?, ?, ?, ?)");
$stmt->execute([$user_id, $drama_id, $total_score, $watch_time_snapshot, $comments]);
$production_rating_id = $pdo->lastInsertId();
$val_stmt = $pdo->prepare("INSERT INTO production_rating_values (production_rating_id, parameter_id, score) VALUES (?, ?, ?)");
foreach ($param_scores as $p_id => $p_score) {
$val_stmt->execute([$production_rating_id, (int)$p_id, (float)$p_score]);
}
$pdo->commit();
header("Location: dashboard.php?status=rated");
exit();
} catch (Exception $e) {
$pdo->rollBack();
die("FATAL ERROR: Could not save rating. " . $e->getMessage());
}
}
include '../includes/header.php';
?>
Production Evaluation
= htmlspecialchars($drama['title']) ?>
Provide marks for each criteria based on the overall quality of the production.