Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/04/2010, 18:09
Avatar de reborn
reborn
 
Fecha de Ingreso: febrero-2010
Mensajes: 440
Antigüedad: 14 años, 2 meses
Puntos: 1
Error sistema de votos

Buenas, quiero integrar este pequeño y sencillo script de votos al sistema de noticias de mi web.
No requiere base de datos y le di los permisos q dice la guia de instalacion pero al chequear si funciona o no, me sale el siguiente error:

Warning: fopen(vote/.dat) [function.fopen]: failed to open stream: No such file or directory in /home/****/public_html/vote/vote.php on line 27


PHP Error Message

Warning: fputs(): supplied argument is not a valid stream resource in /home/****/public_html/vote/vote.php on line 28


Warning: fclose(): supplied argument is not a valid stream resource in /home/****/public_html/vote/vote.php on line 29


Warning: file(vote/.dat) [function.file]: failed to open stream: No such file or directory in /home/****/public_html/vote/vote.php on line 64

...el unico archivo q integra el script es vote.php:
Código PHP:
<? 
extract
($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
 
$ficdest1=explode(".",basename($PHP_SELF)); 
$ficdest="vote/".$ficdest1[0].".dat"
$ip getenv(REMOTE_ADDR); 
    if(
file_exists($ficdest)) { 
     
$compteur=fopen($ficdest"r"); 
     
$old_stats=file($ficdest); 
     
$stats=explode("|"$old_stats[0]); 
     
fclose($compteur); 
     
$new_count=$stats[0]; 
     
$ip_hit=$ip;

else { 
     
$nouveau_compteur=fopen($ficdest"w"); 
     
fputs($nouveau_compteur"0|0|0|0|"); 
     
fclose($nouveau_compteur); 


if (!empty(
$envoi)&& $note !="") { 
$vote=fopen($ficdest"r"); 
$old_stats=file($ficdest); 
$stats=explode("|"$old_stats[0]); 
fclose($vote); 
$nbr_votes=$stats[0]; 
$moy_votes=$stats[1]; 
if (
$stats[3] != $ip) {
$new_count $stats[0]+1;         
if(
$note=="Good"){
$moy_votes1=$moy_votes+1;
$statical=$stats[2];
}elseif(
$note=="Bad"){
$statical=$stats[2]+1;
$moy_votes1=$moy_votes;
}
$vote=fopen($ficdest"w"); 
$new_stats=fputs($vote"$new_count|$moy_votes1|$statical|$ip|"); 
fclose($vote); 
echo 
"<font face=Verdana size=2 color=blue>Thank you for voting</font>";

else { echo 
"<font face=Verdana size=2 color=red>You have already voted</font>";
     
$vote=fopen($ficdest"w"); 
     
$new_stats=fputs($vote"$stats[0]|$stats[1]|$stats[2]|$ip|"); 
     
fclose($vote); 


}
?>
<!-- Copyright Scriptsez.net Visit http://www.scriptsez.net to get this script for Free -->
<?php
print ("<form method=post>"); 
$old_stats=file($ficdest); 
$stats=explode("|"$old_stats[0]);
$total=($stats[1]+$stats[2]);
if(
$total<="0"){
$total="1";
$mtotal="Not yet voted";
}else{
    if(
$total=="1"){$spell="vote";}else{$spell="votes";}
$mtotal="$total $spell";
}
$gpercentage=(($stats[1]/$total)*1000);
$goodp=round(($gpercentage 10 10))/10;
$bpercentage=(($stats[2]/$total)*1000);
$badp=round(($bpercentage 10 10))/10;
echo 
"<table><tr><td><img src=images/thumbs_up.gif>$goodp %</td><td> &nbsp; </td><td><img src=images/thumbs_down.gif>$badp %</td><td>[$mtotal]</td></tr></table>";
echo
"<table><tr><td align=center><img src=images/thumbs_up.gif></td><td><input type=radio name=note value=Good>Good</td>";
echo
"<td align=center><img src=images/thumbs_down.gif></td><td><input type=radio name=note value=Bad>Bad</td>";
print (
"<td><input type=hidden name=envoi value=1><input type=submit value=Vote style=background:#ffcc00;border-width:1;Border-color:#ffcc00;></td></tr></table></form></font>");
?>
...la verdad no se donde esta el error.

Gracias.