<?php
require_once('../config/database.php');
include_once '../security/session_config.php';
include_once '../security/csrf.php';
include_once '../security/session_config.php';
include_once '../security/csrf.php';
// include objects
include_once "../resources/offering.php";
include_once '../config/properties.php';
$csrf_token = $_POST['csrf_token'];
validate_csrf_request($csrf_token);

// initialize objects
$offering = new Offering();
$rating_value = 0;
$comment = null;
$offering_id = $_POST['offering_id'];
$user_id = $_POST['user_id'];
$offering->offering_id = $offering_id;
$offering->user_id = $user_id;
$stmt = $offering->get_your_rating_value();
if ($stmt->rowCount() > 0) {
    if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        $rating_value = $row['rating_value'];
        if ($row['comments'] != "") {
            $comment = $row['comments'];
        }
    }
}
echo $rating_value;
echo "<br/>";
echo $comment;
?>

