📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
blogscripti.demodesign.com.tr
📝
update_rating.php
← Geri Dön
<?php // Check if the rating option is selected if (isset($_POST['rating']) && in_array($_POST['rating'], ['angry', 'sad', 'ok', 'good', 'happy'])) { // Update the rating count in your database // Use $_POST['rating'] to update the corresponding rating count // Sample code to update the rating count $rating = $_POST['rating']; // Assume you have a table named "ratings" with columns "rating_option" and "rating_count" // Update the rating count for the given rating option // You need to modify this code to fit your specific database structure and query method $query = "UPDATE ratings SET rating_count = rating_count + 1 WHERE rating_option = '$rating'"; // Execute the query using your database connection object // You need to modify this code to fit your specific database connection method // $connection->query($query); // Return the updated rating counts as a response // You can retrieve the updated counts from your database and return them as a JSON response $angryCount = 10; // Replace with the actual count from your database $sadCount = 20; // Replace with the actual count from your database $okCount = 30; // Replace with the actual count from your database $goodCount = 40; // Replace with the actual count from your database $happyCount = 50; // Replace with the actual count from your database $response = [ 'success' => true, 'reactions' => [ 'angry' => $angryCount, 'sad' => $sadCount, 'ok' => $okCount, 'good' => $goodCount, 'happy' => $happyCount, ], ]; // Send the JSON response header('Content-Type: application/json'); echo json_encode($response); exit; } else { // Invalid rating option ?>
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula