0) { //this user voted for this video ID //if ( $stop == 1 ) { if ( $count > 0 ) { $msg = " -- You have voted all ready!"; echo "COUNT " . $count . " " . $msg; exit; $text = ''; if($show5 || $showPerc || $showVotes){ $text .= '
'; } if($show5){ $text .= 'Rated '.outOfFive($id).'/5'; } if($showPerc){ $text .= ' ('.getRating($id).')'; } if($showVotes){ $text .= ' ('.getVotes($id).')'; } if($show5 || $showPerc || $showVotes){ $text .= ''; } return $text.'
'; exit; } else{ $sel = mysql_query("SELECT user_id FROM rating WHERE IP = '".$_SERVER['REMOTE_ADDR']."' AND video_id = '$id'"); if(mysql_num_rows($sel) > 0 || $static == 'novote' || $_COOKIE['has_voted_'.$id]){ if ($static == 'novote'){ $msg = " Please Login to vote"; $text = ''; }else{ $msg = " -- You have voted for this video"; $text = ''; } if($show5 || $showPerc || $showVotes){ $text .= '
'; } if($show5){ $text .= 'Rated '.outOfFive($id).'/5'; } if($showPerc){ $text .= ' ('.getRating($id).')'; } if($showVotes){ $text .= ' ('.getVotes($id).')'; } if($show5 || $showPerc || $showVotes){ $text .= ''; } return $text.'
'; } else { if($show5 || $showPerc || $showVotes){ $text .= '
'; } if($show5){ $show5bool = 'true'; $text .= 'Rated '.outOfFive($id).'/5'; } else { $show5bool = 'false'; } if($showPerc){ $showPercbool = 'true'; $text .= ' ('.getRating($id).')'; } else { $showPercbool = 'false'; } if($showVotes){ $showVotesbool = 'true'; $text .= ' ('.getVotes($id).')'; } else { $showVotesbool = 'false'; } if($show5 || $showPerc || $showVotes){ $text .= ''; } return $text.'
'; } } } // Added in version 1.5 function getTopRated($limit, $table, $idfield, $namefield){ $result = ''; $sql = "SELECT ratings.rating_id,".$table.".".$namefield." as thenamefield,ROUND(AVG(ratings.rating_num),2) as rating FROM ratings,".$table." WHERE ".$table.".".$idfield." = ratings.rating_id GROUP BY rating_id ORDER BY rating DESC LIMIT ".$limit.""; $sel = mysql_query($sql); $result .= ''."\n"; return $result; } ?>