else
$Result.="<font color="#FFFFFF" size="1" face="Arial">Thank you for rating this attraction!</font>";
}
Should be
else
{
$Result.='<font color="#FFFFFF" size="1" face="Arial">Thank you for rating this attraction!</font>';
}
Also you should indent your code so its easily readable.
<?php
/*
RATING SCRIPT
Rate anything!
*/
function rate($name)
{
if (file_exists("votes/$name.txt"))
{
$fp = fopen("votes/$name.txt", "r");
$ligne = fgets($fp,4096);
//we retrieve variables
$tt_votes = strrchr($ligne, "|");
$tt_votes = str_replace("|", "", $tt_votes);
$tt_votes = trim($tt_votes);
$ligne = strrev($ligne);
$nb_votes = strrchr($ligne, "|");
$nb_votes = strrev($nb_votes);
$nb_votes = str_replace("|", "", $nb_votes);
$nb_votes = trim($nb_votes);
fclose($fp);
// Calculs :
if (($tt_votes == 0) AND ($nb_votes == 0))
{
// Si fichier vide
$etoiles_oui = 0;
$note = "0.00";
}
else
{
$moy_en = $tt_votes/$nb_votes;
$etoiles = round($moy_en);
$note = round($moy_en, 2);
}
$Result = "";
if ($nb_votes > 0)
{
$Result .="<img src=\"rating/".$etoiles."stars.gif\" border=\"0\" alt=\"Rate\">";
}
else
{
$Result .='<img border="0" src="rating/nostars.gif">';
}
if (!isset($_COOKIE[$name]))
{
$Result.="</td><form name=\"rate\" action=\"takerate.php?name=$name\" method=\"post\" onSubmit=\"alert('Thank you for voting!');\" > ";
$Result.='<select name=\"note\" style="margin: 0; font-size: 8 pt; font-family: Verdana; border: 0">';
$Result.="<option value =\"5\">5 - Excellent</option>";
$Result.="<option value =\"4\">4 - Very Good</option>";
$Result.="<option value =\"3\">3 - Fair</option>";
$Result.="<option value =\"2\">2 - Ok</option>";
$Result.="<option value =\"1\">1 - Poor</option>";
$Result.="<option value =\"0\">0 - Awful</option>";
$Result.="</select>";
$Result.=" <input type=\"submit\" value=\"Rate\"></form>";
}
else
{
$Result.='<font color="#FFFFFF" size="1" face="Arial">Thank you for rating this attraction!</font>';
}
}
else
{
$Result.="</td><form name=\"rate\" action=\"takerate.php?name=$name\" method=\"post\" onSubmit=\"alert('Thank you for voting!');\" > ";
$Result.='<select name=\"note\" style="margin: 0; font-size: 8 pt; font-family: Verdana; border: 0">';
$Result.="<option value =\"5\">5 - Excellent</option>";
$Result.="<option value =\"4\">4 - Very Good</option>";
$Result.="<option value =\"3\">3 - Fair</option>";
$Result.="<option value =\"2\">2 - Ok</option>";
$Result.="<option value =\"1\">1 - Poor</option>";
$Result.="<option value =\"0\">0 - Awful</option>";
$Result.="</select>";
$Result.=" <input type=\"submit\" value=\"Rate\"></form>";
}
return $Result;
}
?>