0) AND ( visible >0) ORDER BY votes DESC, rate DESC, pid ASC LIMIT 0, 10"; $result = $db->sql_query($sql); //echo $sql . "

" .mysql_error(); $messages = ""; $i = 1; while ($pic = $db->sql_fetchrow($result)) { $pic['description'] = substr($pic['description'],0,255); if (strlen($pic['name']) > 15 ) { $pic['name'] = substr($pic['name'],0,14)."."; } $galloc = $pic['galloc']; $img = $pic['img']; $ext = substr($img, (strrpos($img,'.') + 1)); if (file_exists("$gallerypath/$galloc/thumb/$img")) { $thumb = "$pic[description]"; } else { $row = $db->sql_fetchrow($db->sql_query("SELECT thumbnail from $prefix"._gallery_media_types." where extension='$ext'")); $thumb = "$pic[description]"; } if ($pic['visible'] == 1) { if (is_user($user)) { $messages .= "
.:No $i:.
Votes:$pic[votes]x
$thumb
$pic[name]
by
$pic[submitter]

\n"; } else { $messages .= "
.:No $i:.
Votes:$pic[votes]x
$thumb
$pic[name]
by
$pic[submitter]

\n"; } } else { $messages .= "
.:No $i:.
Votes:$pic[votes]x
$thumb
$pic[name]
by
$pic[submitter]

\n"; } $i++; } if($messages== "") { $messages = "




None
Voted
Pictures
\"\n"; } $content = "
"; $content .= "\n".$messages."
"; ?>