Anyone know nice rating scipt that let user select rating from 1 to 10, and then shows it with stars, bar or just numbers?
It must be use only flat database, because my freehost not allow MySQL or other databases.
Anyone know nice rating scipt that let user select rating from 1 to 10, and then shows it with stars, bar or just numbers?
It must be use only flat database, because my freehost not allow MySQL or other databases.
Here's one:
http://www.hotscripts.com/Detailed/18294.html
A Five star rating system which works without any database. IP address recording prevents from multiple voting from the same user. Only one working file rate.php. Updated version displays more accurate rating.
Very nice script! I have seen this many times when seekin rating script with google, but I always found version that pays.
But this is great. Thanks a lot! Even that "pop-up mania" won't piss me off.
But must go to build site and drink some coffee.
I celebrate too early. :eek:
This script only works when have one vote per/one page. But I need to use many rates in same page.
How I should solve this?
This script thinks that .dat files residents in root directory, but I want these files to rate -directory.
so.. how do I must modify the code, to let it know that .dat files should be in rate directory and not in root directory?
Here's whole code. So what should I modify? (last question.)
And how you suggest to use this when I have multiple rating in one page?
<?
/****** PHP RATING SYSTEM v1.2 ******
Copyright 2002, Cgixp.netfirms.com
You have to leave the copyright.
If you have any problem just let us know.
E-mail: alipf@myecom.net
Website: http://www.cgixp.netfirms.com
*******************************************/
$ficdest=explode(".",basename($PHP_SELF));
$ficdest=$ficdest[0].".dat";
if(file_exists($ficdest)) {
$compteur=fopen($ficdest, "r");
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
fclose($compteur);
$new_count=$stats[0];
if ($stats[3] != $REMOTE_ADDR) {
$new_count +=1;
}
$ip_hit=$REMOTE_ADDR;
$compteur=fopen($ficdest, "w");
fputs($compteur, "$new_count|$stats[1]|$stats[2]|$ip_hit|$stats[4]");
fclose($compteur);
}
else {
$nouveau_compteur=fopen($ficdest, "w");
fputs($nouveau_compteur, "1|||$REMOTE_ADDR|");
fclose($nouveau_compteur);
}
if (!empty($envoi)) {
$vote=fopen($ficdest, "r");
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
fclose($vote);
$nbr_votes=$stats[1];
$moy_votes=$stats[2];
if ($stats[4] != $REMOTE_ADDR) {
$nbr_votes +=1;
$moy_votes=((($stats[1]*$stats[2])+$note)/$nbr_votes);
}
else { echo "<font face=Verdana size=2 color=red>You have already voted</font>"; }
$ip_vote=$REMOTE_ADDR;
$vote=fopen($ficdest, "w");
$new_stats=fputs($vote, "$new_count|$nbr_votes|$moy_votes|$stats[3]|$ip_vote");
fclose($vote);
}
print ("<form method=post>");
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
if ($stats[2]>=5)
{
$star = "images/5star.gif" ;
}
if ($stats[2]<=4.5)
{
$star = "images/45star.gif" ;
}
if ($stats[2]<=4)
{
$star = "images/4star.gif" ;
}
if ($stats[2]<=3.5)
{
$star = "images/35star.gif" ;
}
if ($stats[2]<=3)
{
$star = "images/3star.gif" ;
}
if ($stats[2]<=2.5)
{
$star = "images/25star.gif" ;
}
if ($stats[2]<=2)
{
$star = "images/2star.gif" ;
}
if ($stats[2]<=1.5)
{
$star = "images/15star.gif" ;
}
if ($stats[2]<=1)
{
$star = "images/1star.gif" ;
}
if ($stats[2]<=0.5)
{
$star = "images/05star.gif" ;
}
if ($stats[2]<=0)
{
$star = "images/00star.gif" ;
}
print ("<font size=1 face=Verdana color=#999999>Rating: <img src=\"$star\" alt=\"Average rating: $stats[2]\"> $stats[1] Ratings</font>");
print (" <select name=note>");
for ($i=1; $i<=5; $i++) {
print ("<option value=$i>$i");
}
print (" <input type=hidden name=envoi value=1><input type=submit value=Rate>");
print ("</select></form></font>");
?>