Bueno espero que te sirva ;)
Código PHP:
<center>
<?
$rater_ip_voting_restriction = true;
$rater_ip_vote_qty=1; // Cuantas veses puede votar la misma IP (1)
$rater_already_rated_msg="Solo aceptamos 1 voto por Día";
$rater_not_selected_msg="No has dado ni una estrella";
$rater_thankyou_msg="Gracias por Votar";
$rater_generic_text="Este tema";
$rater_end_of_line_char="n";
if(!isset($rater_id)) $rater_id=1;
if(!isset($rater_item_name)) $rater_item_name=$rater_generic_text;
// No borres nada de aqui
$rater_filename='item_'.$rater_id.".rating";
$rater_rating=0;
$rater_stars="";
$rater_stars_txt="";
$rater_rating=0;
$rater_votes=0;
$rater_msg="";
// Aqui estan las acciones al votar
if(isset($_REQUEST["rate".$rater_id])){
if(isset($_REQUEST["rating_".$rater_id])){
while(list($key,$val)=each($_REQUEST["rating_".$rater_id])){
$rater_rating=$val;
}
$rater_ip = getenv("REMOTE_ADDR");
$rater_file=fopen($rater_filename,"a+");
$rater_str="";
$rater_str = rtrim(fread($rater_file, 1024*8),$rater_end_of_line_char);
if($rater_str!=""){
if($rater_ip_voting_restriction){
$rater_data=explode($rater_end_of_line_char,$rater_str);
$rater_ip_vote_count=0;
foreach($rater_data as $d){
$rater_tmp=explode("|",$d);
$rater_oldip=str_replace($rater_end_of_line_char,"",$rater_tmp[1]);
if($rater_ip==$rater_oldip){
$rater_ip_vote_count++;
}
}
if($rater_ip_vote_count > ($rater_ip_vote_qty - 1)){
$rater_msg=$rater_already_rated_msg;
}else{
fwrite($rater_file,$rater_rating."|".$rater_ip.$rater_end_of_line_char);
$rater_msg=$rater_thankyou_msg;
}
}else{
fwrite($rater_file,$rater_rating."|".$rater_ip.$rater_end_of_line_char);
$rater_msg=$rater_thankyou_msg;
}
}else{
fwrite($rater_file,$rater_rating."|".$rater_ip.$rater_end_of_line_char);
$rater_msg=$rater_thankyou_msg;
}
fclose($rater_file);
}else{
$rater_msg=$rater_not_selected_msg;
}
}
// Esto agarra lo que se a votado
if(is_file($rater_filename)){
$rater_file=fopen($rater_filename,"r");
$rater_str="";
$rater_str = fread($rater_file, 1024*8);
if($rater_str!=""){
$rater_data=explode($rater_end_of_line_char,$rater_str);
$rater_votes=count($rater_data)-1;
$rater_sum=0;
foreach($rater_data as $d){
$d=explode("|",$d);
$rater_sum+=$d[0];
}
$rater_rating=number_format(($rater_sum/$rater_votes), 2, '.', '');
}
fclose($rater_file);
}else{
$rater_file=fopen($rater_filename,"w");
fclose($rater_file);
}
// Aqui se aplica la imagen segun el voto
if ($rater_rating <= 0 ){$rater_stars = "http://i48.tinypic.com/1sjvpu.gif";$rater_stars_txt="0";}
if ($rater_rating >= 0.5){$rater_stars = "http://i49.tinypic.com/vy6vpt.gif";$rater_stars_txt="0.5";}
if ($rater_rating >= 1 ){$rater_stars = "http://i46.tinypic.com/2lwppno.gif";$rater_stars_txt="1";}
if ($rater_rating >= 1.5){$rater_stars = "http://i48.tinypic.com/5xjz5.gif";$rater_stars_txt="1.5";}
if ($rater_rating >= 2 ){$rater_stars = "http://i46.tinypic.com/334hnx3.gif";$rater_stars_txt="2";}
if ($rater_rating >= 2.5){$rater_stars = "http://i50.tinypic.com/33tq78i.gif";$rater_stars_txt="2.5";}
if ($rater_rating >= 3 ){$rater_stars = "http://i48.tinypic.com/500777.gif";$rater_stars_txt="3";}
if ($rater_rating >= 3.5){$rater_stars = "http://i47.tinypic.com/vq7g2o.gif";$rater_stars_txt="3.5";}
if ($rater_rating >= 4 ){$rater_stars = "http://i47.tinypic.com/11wa655.gif";$rater_stars_txt="4";}
if ($rater_rating >= 4.5){$rater_stars = "http://i48.tinypic.com/5ygh9f.gif";$rater_stars_txt="4.5";}
if ($rater_rating >= 5 ){$rater_stars = "http://i47.tinypic.com/2w24lmb.gif";$rater_stars_txt="5";}
// El resultado
echo '<div class="hreview">';
echo '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
echo '<br><h3 class="item"><span class="Estilo1">¿Qué opinas de Servidor ...!?</span></h3>';
echo '<div>';
echo '<span class="rating"><img src="'.$rater_stars.'?x='.uniqid((double)microtime()*1000000,1).'" alt="'.$rater_stars_txt.' stars" /> '.$rater_stars_txt.'</span> <span class="reviewcount"> Estrellas de '.$rater_votes.' votos</span>.';
echo '</div>';
echo '<div>';
echo '<label for="rate5_'.$rater_id.'"><input type="radio" value="5" name="rating_'.$rater_id.'[]" id="rate5_'.$rater_id.'" />Muy bueno</label>';
echo '<label for="rate4_'.$rater_id.'"><input type="radio" value="4" name="rating_'.$rater_id.'[]" id="rate4_'.$rater_id.'" />Bueno</label>';
echo '<label for="rate3_'.$rater_id.'"><input type="radio" value="3" name="rating_'.$rater_id.'[]" id="rate3_'.$rater_id.'" />Masomenos</label>';
echo '<label for="rate2_'.$rater_id.'"><input type="radio" value="2" name="rating_'.$rater_id.'[]" id="rate2_'.$rater_id.'" />Regular</label>';
echo '<label for="rate1_'.$rater_id.'"><input type="radio" value="1" name="rating_'.$rater_id.'[]" id="rate1_'.$rater_id.'" />Malo<br></label>';
echo '<input type="hidden" name="rs_id" value="'.$rater_id.'" />';
echo '<input type="submit" name="rate'.$rater_id.'" value="Votar!" />';
echo '</div>';
if($rater_msg!="") echo "<div>".$rater_msg."</div>";
echo '</form>';
echo '</div>';
?>
</center>
Las
IP de los votantes se guardan en item_1, y si te aparece ya haz votado será por que lo tas haciendo desde el localhost, cuando tu votas lo guarda como
ip fija 127.0.0.1 y eso no cambia x eso solo te permite votar 1 ves ;)
Solo permite 1 voto x IP (o sea por día)
Sube a algún hosting y verá ;)