Files
Siro/backend/ride/rate/add_rate_app.php
2026-06-09 08:40:31 +03:00

34 lines
1.1 KiB
PHP
Executable File

<?php
require_once __DIR__ . '/../../connect.php';
$name = filterRequest("name");
$email = filterRequest("email");
$phone = filterRequest("phone");
$userId = filterRequest("userId");
$userType = filterRequest("userType");
$rating = filterRequest("rating");
$comment = filterRequest("comment");
$email = $encryptionHelper->encryptData($email);
$phone = $encryptionHelper->encryptData($phone);
// Insert into `ratingApp` table
$sql = "INSERT INTO `ratingApp`(`id`, `name`, `email`, `phone`, `userId`, `userType`, `rating`, `comment`)
VALUES (null, :name, :email, :phone, :userId, :userType, :rating, :comment)";
$stmt = $con->prepare($sql);
$stmt->bindParam(':name', $name);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':phone', $phone);
$stmt->bindParam(':userId', $userId);
$stmt->bindParam(':userType', $userType);
$stmt->bindParam(':rating', $rating);
$stmt->bindParam(':comment', $comment);
$stmt->execute();
if ($stmt->rowCount() > 0) {
jsonSuccess($message = 'Rating inserted successfully');
} else {
jsonError($message = "Failed to save rating information");
}
?>