is_array($checkIP) ? array_push($checkIP, $ip) : ($checkIP = array($ip)); $insertIP = serialize($checkIP); //it serialize IP to {i:0;s:9:"127.0.0.1} this formate //IP check when voting if there is no cookie then create the cookie if (!isset($_COOKIE['rating_' . $id_sent])) { $usedIp = new Ratings(); $voted = $usedIp->usedIP($ip, $id_sent); } else { $voted = 1; } //var_dump($id_sent); if (!$voted) { //if the user hasn't yet voted, then vote normally... if ($vote_sent >= 1 && $vote_sent <= $units) { $updateRate = new Ratings(); $result = $updateRate->updateRating($added, $sum, $insertIP, $id_sent); if ($result) { setcookie("rating_" . $id_sent, 1, time() + 2592000, '/'); } } } //end for the "if(!$voted)" // these are new queries to get the new values! $disAll = new Ratings(); $numbers = $disAll->displayValues($id_sent); //$numbers = mysql_fetch_assoc($newtotals); $count = $numbers['total_votes']; //how many votes total $current_rating = $numbers['total_value']; //total number of rating added together and stored $tense = $count == 1 ? "vote" : "votes";