require_once './Model/Ratings.php'; $db = Database::getDB(); $units = Database::unit(); $getRollId = Project\Auth\models\AuthModel::getUser('roleId'); if ($getRollId === false) { echo "Please Login First to Rate the movies !! Thank You."; } else { $ip = \Project\Auth\models\AuthModel::getUser('id'); //getting id of movie-1,2,3 which one is click that id from the rating.js page $id_sent = preg_replace("/[^0-9]/", "", $_REQUEST['id']); //Take the value of star based on user select Ex-user select 1-5 star take that value $vote_sent = preg_replace("/[^0-9]/", "", $_REQUEST['stars']); // Get The IP address of the local server host machine. //$ip =$_SERVER['REMOTE_ADDR'] ; $getIP = new Ratings(); $getIP->getRating_IP($id_sent); // kill the script if ($vote_sent > $units) { die("Sorry, vote appears to be invalid."); } $disAll = new Ratings(); $numbers = $disAll->displayValues($id_sent); $checkIP = unserialize($numbers['used_ips']); $count = $numbers['total_votes']; //Grab total votes from database column $current_rating = $numbers['total_value']; //total number of rating added together and stored $sum = $vote_sent + $current_rating; // add together the current vote value and the total vote value $tense = $count == 1 ? "vote" : "votes"; $sum == 0 ? $added = 0 : ($added = $count + 1);