@session_start();
require ("shared.php");
$classpage = new Page();
//include("includes/hit.inc");
$classpage->displayTop(88, "Soutěž");
echo "
Soutěž
\n";
echo "\n";
echo "Náhledy soutěžních obrázků
\n";
@ $rocnik = $_GET["rocnik"];
@ $galerieid = $_GET["galerieid"]; // id fotky
if(!isset($galerieid)) $galerieid = 2;
if(!isset($rocnik)) $rocnik = 2008;
@ $id = $_GET["id"]; // id fotky
@ $pripojit = mysql_pconnect($classpage->mysql_server,$classpage->mysql_login,$classpage->mysql_pass);
@ $vyberdb = mysql_select_db($classpage->mysql_db);
$query = "SELECT imgname, width, height, popis, autor
FROM handicap_soutez
WHERE id = ".$id;
// @ mysql_query("SET NAMES 'cp1250'");
if($get_foto = mysql_query($query)) {
$row_foto = mysql_fetch_array($get_foto);
$imgname = $row_foto["imgname"];
$width = $row_foto["width"];
$height = $row_foto["height"];
$popis = $row_foto["popis"];
$autor = $row_foto["autor"];
$query_ids = "SELECT id FROM handicap_soutez WHERE rocnik = ".$rocnik." AND galerieid = ".$galerieid." ORDER BY id";
if($get_ids = mysql_query($query_ids)) {
$number_ids = mysql_num_rows($get_ids);
$ids = array();
for($g = 0; $g < $number_ids; $g++) {
$row_id = mysql_fetch_array($get_ids);
array_push($ids, $row_id["id"]);
} // end for
if(count($ids) > 0) {
echo "";
echo "";
for($k = 0; $k < count($ids); $k++) { // zjistim pozici aktualniho id v poli vsech id
if($id == $ids[$k]) {
$pozice = $k;
break;
}
else continue;
} // end for
// echo $pozice;
echo "";
if($pozice > 0) echo "PŘEDCHOZÍ";
echo "OBRÁZEK ".($pozice + 1)." / ".$number_ids."";
if(($pozice+1) < count($ids)) echo "NÁSLEDUJÍCÍ";
else echo " | ";
echo "
";
echo "
\n";
} // end ids array ok
} // end result ids
} // end result
else {
$chyba = 2;
echo "Selhalo připojení k databázi, zkuste to prosím později.
\n";
}
if($chyba < 2) {
echo "\n";
//log hit
$query_log = "UPDATE handicap_soutez SET hits = hits + 1 WHERE id = ".$id;
@ mysql_query($query_log);
} // end bez chyby
$classpage -> displayBottom(); ?>