Witam, niedawno znalazłem skrypt php pozwalający na oddawanie swojej oceny. Wszystko działa w porządku, ale w skrypcie tym można oddawać ocenę tylko dla jednej rzeczy/strony. Czy mógłby mi ktoś pomóc w stowrzeniu czegoś typu tego, że wpisując rate.php?id=x (rate.php to przykładowy plik ze skryptem) oddaje się inną niezależną ocenę?
Tu daję link do całego skryptu z obrazkami:
http://www.scriptsez.net/download/download...em.zip&ns=1, a poniżej kod skryptu oceny:
<?
/********* PHP RATING SYSTEM v1.5 ************
Copyright Scriptsez.net
You have to leave the copyright.
If you have any problem just let us know.
E-mail: support@scriptsez.net
Website: <a href=\"http://www.scriptsez.net\" target=\"_blank\">http://www.scriptsez.net</a>
**********************************************/
$ficdest=$ficdest[0].".dat";
$compteur=fopen($ficdest, "r"); $old_stats=file($ficdest); $stats=explode("|", $old_stats[0
]); $new_count=$stats[0];
if ($stats[3] != $ip) {
$new_count +=1;
}
$ip_hit=$ip;
$compteur=fopen($ficdest, "w"); fputs($compteur, "$new_count|$stats[1]|$stats[2]|$ip_hit|$stats[4]"); }
else {
$nouveau_compteur=fopen($ficdest, "w"); fputs($nouveau_compteur, "1|||$ip|"); }
$vote=fopen($ficdest, "r"); $old_stats=file($ficdest); $stats=explode("|", $old_stats[0
]); $nbr_votes=$stats[1];
$moy_votes=$stats[2];
if ($stats[4] != $ip) {
$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=$ip;
$vote=fopen($ficdest, "w"); $new_stats=fputs($vote, "$new_count|$nbr_votes|$moy_votes|$stats[3]|$ip_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]>=1)
{
$star = "images/1star.gif" ;
}
if ($stats[2]>=1.5)
{
$star = "images/15star.gif" ;
}
if ($stats[2]>=2)
{
$star = "images/2star.gif" ;
}
if ($stats[2]>=2.5)
{
$star = "images/25star.gif" ;
}
if ($stats[2]>=3)
{
$star = "images/3star.gif" ;
}
if ($stats[2]>=3.5)
{
$star = "images/35star.gif" ;
}
if ($stats[2] >= 4)
{
$star = "images/4star.gif" ;
}
if ($stats[2] >= 4.5)
{
$star = "images/45star.gif" ;
}
if ($stats[2] >= 5)
{
$star = "images/5star.gif" ;
}
if ($stats[2]<=0)
{
$star = "images/00star.gif" ;
}
print ("<table bordercolor=#99999 cellspacing=0 border=0><td width=50% cellspacing=none cellpadding=none align=middle valign=middle border=1><font size=1 face=Verdana color=#999999>Rating: <img src=\"$star\" alt=\"Average rating: $stats[2]\"> $stats[1] Ratings</td><tr></font>"); echo"<td align=middle valign=middle><input type=radio name=note value=5><font face=arial size=2 color=#99999>Excellent"; echo"<input type=radio name=note value=4>Very Good"; echo"<input type=radio name=note value=3>Good"; echo"<input type=radio name=note value=2>Fine"; echo"<input type=radio name=note value=1>Bad"; print ("<input type=hidden name=envoi value=1> <input type=submit value=Rate style=background:#ffcc00;border-width:1;Border-color:#ffcc00;></table></form></font></td>");
?>
Ten post edytował Mieczu 28.12.2007, 11:24:11