PHP su sistema votazioni configurabile a 5/10 stelle

manablo7

Nuovo Utente
21 Apr 2009
1
0
0
Questo e' il mio problema (ed e' da 25 ore che nn riesco a venirne fuori, spero possiate aiutarmi):

Ho da poco acquistato il sistema di votazioni della flashden, e dovrei inserirlo sulle foto (e dico ognuna delle foto) del sito www.naturart.altervista.org . Le spiegazioni nel file help nn mi sono state molto d'aiuto, infatti sono un po' spartane.

Il file rate.php che posto sotto deve essere modificato al suo interno?

__________________________________________________________
<?
// No error message
error_reporting(E_ALL ^ E_NOTICE);

// Set some config
// ----------------------------------------
// ----------------------------------------
// ----------------------------------------
$used_ip = "ipBackup/ips.txt";
$item_list ="items.xml";
$star_limit = 5;
// ----------------------------------------
// ----------------------------------------
// ----------------------------------------


// Get users ip
$current_ip = $_SERVER['REMOTE_ADDR'];

// Default voted false
$voted = false;
// Requests make numeric.
$id = @number_format($_REQUEST["id"]);
$rate = @number_format($_REQUEST["rate"]);

// If user already voted for this item
$check_ip=fopen($used_ip,"r");
while (!feof($check_ip)){
$lines=fgets($check_ip,1024);
if($lines==$current_ip."/ID:".$id."\n"){
echo "&state=Already voted";
$voted = true;
exit;
}
}

// Reuquests to check.
if(empty($id) || empty($rate) || !is_numeric($id) || !is_numeric($rate) || $rate > $star_limit || $rate < 1) {
echo "&state=Error&notice=Warning request";
exit;
}


if($voted != true){
$record_ip=fopen($used_ip,"a");
fwrite($record_ip,$current_ip."/ID:".$_REQUEST[id]."\n");
fclose($record_ip);

$getfile=@file_get_contents($item_list);

if ($getfile) {
$id=explode("<item id=\"",$getfile);

$str = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$str .= "<items>\n";

for ($i = 1; $i <= sizeof($id)-1; $i++) {
$items = explode("\"",$id[$i]);
if($items[0] == $_REQUEST[id]){

$old_rate = @number_format($items[2]);
$total_votes = @number_format($items[4]);
$new_rate = round(((($old_rate * $total_votes) + $rate) / (++$total_votes)),1);

}else{
$new_rate = @round($items[2],1);
$total_votes = @number_format($items[4]);
}

$str .= " <item id=\"".$items[0]."\" ";
$str .= "rate=\"".$new_rate."\" ";
$str .= "votes=\"".$total_votes."\"/>\n";

}

$str .= "</items>";
echo "&state=Thanks for voting!";
$fp = fopen($item_list, 'r+');
fwrite($fp, $str);
fclose($fp);
}
}
?>
_________________________________________________________

Premettendo che di sicuro il file item.xml andra' modificato cosa devo fare per far funzionare il "plug-in" nel mio sito (in flash)?

Posto il link immagine dei file presenti nella cartella...
http://img178.imageshack.us/img178/2353/forimageshack.jpg

Spero possiate aiutarmi... grazie infinite
 

Discussioni simili