Fotoaktion
blablabla
$items = array();
while ($row = mysql_fetch_assoc($result)) {
if (trim($row[„id“]) != „“ && is_numeric($row[„id“])) {
$items[$row[„id“]][‚id‘] = $row[„id“];
$items[$row[„id“]][‚title‘] = $row[„title“];
$items[$row[„id“]][’suffix‘] = $row[„suffix“];
}
}
// shuffle array
shuffle($items);
foreach($items AS $k => $v) {
$current = 0;
$actual = 0;
$css_rating = „current_rating“;
$query = „SELECT (SUM(vote_value)/COUNT(vote_value)) AS value
FROM „.$dbtable[‚votes‘].“
WHERE star_vote_item_id = ‚“.$v[‚id‘].“‚
GROUP BY star_vote_item_id;“;
$result = mysql_query($query, $conn);
if (@mysql_num_rows($result) == 1) {
$row = mysql_fetch_assoc($result);
$current = $row[‚value‘];
$actual = $current;
}
// check if already voted
$query = „SELECT id, vote_value
FROM „.$dbtable[‚votes‘].“
WHERE star_vote_item_id = ‚“.$v[‚id‘].“‚
AND session='“.session_id().“‚
AND UNIX_TIMESTAMP(input_ts) > „.(time()-$vote_session_time).“
ORDER BY input_ts DESC;“;
$result = mysql_query($query, $conn);
if (@mysql_num_rows($result) == 0) {
$li = „
„;
// check cookie
$pos = strpos($_COOKIE[‚dm_star_vote‘], „|“.$v[‚id‘].“=“);
if ($pos === false) {
// do nothing
$tmp = „“;
}
else {
$li = „“;
$css_rating = „star-rating-done“;
$d = explode(„|“.$v[‚id‘].“=“, $_COOKIE[‚dm_star_vote‘]);
$d = explode(„|“, $d[1]);
$actual = $d[0];
if (trim($actual) == „“ || !is_numeric($actual)) {
$actual = $current;
}
$css_rating = „star-rating-done“;
}
}
else {
$li = „“;
$css_rating = „star-rating-done“;
$row = mysql_fetch_assoc($result);
$actual = $row[‚vote_value‘];
$query = „SELECT (SUM(vote_value)/COUNT(vote_value)) AS value
FROM „.$dbtable[‚votes‘].“
WHERE star_vote_item_id = ‚“.$v[‚id‘].“‚
GROUP BY star_vote_item_id;“;
$result = mysql_query($query, $conn);
if (@mysql_num_rows($result) == 1) {
$row = mysql_fetch_assoc($result);
$current = $row[‚value‘];
}
}
$thumb = „/contest-messie/data/“.$v[‚id‘].“.thumbnail.“.$v[’suffix‘];
$img = „/contest-messie/data/“.$v[‚id‘].“.“.$v[’suffix‘];
$title = $v[‚title‘];
$id = $v[‚id‘];
$description = sprintf($vote_description, $current, $vote_max);
include($_SERVER[‚DOCUMENT_ROOT‘].“/contest-messie/template.inc.php“);
}
}
@mysql_free_result($result);
?>