itemId = (int)$itemId; $this->ip = $_SERVER['REMOTE_ADDR']; $this->ratingFile = realpath(__DIR__.'/..').'/ratings/rating_'.$this->itemId.'.json'; if (!is_dir(dirname($this->ratingFile))) { if (!mkdir(dirname($this->ratingFile), 0755, true)) { error_log("Failed to create ratings directory"); } } } public function canRate() { $ratings = $this->getRatings(); $recent = array_filter($ratings, function($r) { return $r['ip'] === $this->ip && strtotime($r['date']) > strtotime('-1 hour'); }); return count($recent) < 3; // Max 3 ratings per hour per IP } public function addRating($ratingValue, $csrfToken) { if (!$this->validateCsrfToken($csrfToken)) { throw new Exception("Invalid CSRF token"); } if (!$this->canRate()) { throw new Exception("Rating limit exceeded"); } $ratings = $this->getRatings(); $ratings[] = [ 'value' => min(5, max(1, (int)$ratingValue)), 'date' => date('Y-m-d H:i:s'), 'ip' => $this->ip ]; $json = json_encode($ratings); if (json_last_error() !== JSON_ERROR_NONE) { throw new Exception("JSON encoding error: ".json_last_error_msg()); } if (file_put_contents($this->ratingFile, $json) === false) { throw new Exception("Failed to save rating"); } } private function validateCsrfToken($token) { if (empty($_SESSION['csrf_token']) || !hash_equals($_SESSION['csrf_token'], $token)) { return false; } return true; } public function generateCsrfToken() { if (empty($_SESSION['csrf_token'])) { $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); } return $_SESSION['csrf_token']; } public function getRatings() { if (!file_exists($this->ratingFile)) { return []; } $data = file_get_contents($this->ratingFile); if ($data === false) { return []; } $ratings = json_decode($data, true); if (json_last_error() !== JSON_ERROR_NONE) { error_log("JSON error: ".json_last_error_msg()); return []; } return is_array($ratings) ? $ratings : []; } public function getAverage() { $ratings = $this->getRatings(); return count($ratings) ? round(array_sum(array_column($ratings, 'value')) / count($ratings), 1) : 0; } public function getCount() { return count($this->getRatings()); } } // Start session for CSRF if (session_status() === PHP_SESSION_NONE) { session_start(); } // Initialize with sanitized input $itemId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT, ['options' => ['default' => 0]]); $ratingSystem = new ProductRating($itemId); // Handle submission $error = null; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['rating_submit'])) { try { $ratingValue = filter_input(INPUT_POST, 'rating_value', FILTER_VALIDATE_INT, [ 'options' => ['min_range' => 1, 'max_range' => 5] ]); if ($ratingValue) { $ratingSystem->addRating($ratingValue, $_POST['csrf_token'] ?? ''); } } catch (Exception $e) { $error = $e->getMessage(); } } ?> {{serverconnect1.data.query1[0].NAME}} in {{serverconnect1.data.query1[0].Gallery}} gallery of {{serverconnect1.data.query1[0].Category}} {{serverconnect1.data.query1[0].SubCategory}} at American Artist's Gallery Showroom: sculptures, paintings.. wildlife, antiques and artist Collectible editions

Chris Dixon Studios Logo

{{serverconnect1.data.query1[0].NAME}}

Original {{serverconnect1.data.query1[0].GalleryFreindlyName}} Gallery of {{serverconnect1.data.query1[0].Category}} and {{serverconnect1.data.query1[0].SubCategory}} Sculpture Artist Editions. Featuring Endangered Wildlife Sculpture Art Editions of {{serverconnect1.data.query1[0].KeyWords}}.

{{serverconnect1.data.query1[0].Description1}} [contact for info.] : {{serverconnect1.data.query1[0].ID_NUM}}:
Note: Photos may vary and each handmade artwork may vary.

Secure shopcart - Keep browser session open to keep items in shopcart!


Price: ${{serverconnect1.data.query1[0].PRICE}} Sale: ${{serverconnect1.data.query1[0].SalePrice}} + ${{serverconnect1.data.query1[0].SHIPPING}} shipping

art search << Back to Search of All Artworks Search HerePrices!
More items in Gallery: {{serverconnect1.data.query1[0].GalleryFreindlyName}} Category: {{serverconnect1.data.query1[0].Category}} SubCategory: {{serverconnect1.data.query1[0].SubCategory}}

Item Details: {{serverconnect1.data.query1[0].NAME}}

{{serverconnect1.data.query1[0].Description2}}
[contact for info.] .


Customer Rating:

getAverage(); echo str_repeat('★', floor($average)); echo ($average - floor($average) >= 0.5) ? '½' : ''; echo str_repeat('☆', 5 - ceil($average)); ?> (/5 from getCount()) ?> ratings)
canRate()): ?>

You've reached the maximum number of ratings allowed per hour.

Similar Items: {{serverconnect1.data.query1[0].Category}}{{serverconnect1.data.query1[0].SubCategory}}

About: {{serverconnect1.data.query1[0].Gallery}}index.htm

Official Collection of "{{serverconnect1.data.query1[0].GalleryFreindlyName}}" Artist Editions {{serverconnect1.data.query1[0].GalleryDescription}} Featuring Endangered Wildlife Sculpture Art Editions.

From mountaintop to tabletop! Wildlife Sculpture editions hand made and custom painted American artist studio statues and paintings professionally made in USA since 1976. This quality American craftsmanship is available as custom made artworks at very reasonable costs that maintain heirloom value. Experience and attention to quality of materials and detail is evident in all these pleasing artworks.


{{serverconnect1.data.query1[0].Gallery}}{{serverconnect1.data.query1[0].ArtistInfo}} [contact for info.]

Ordering Information

Please scroll thru this Artist's unique terms and read before ordering:


 
Copyright © Chris Dixon 1976
All rights reserved.