codice:<?php //EFFETTO LA QUERY $query = "SELECT * FROM fotospeciali, speciali WHERE fotospeciali.id_foto='$id_foto_passato' AND speciali.id='$id_speciale_passato'"; $result = mysql_query($query, $db); $result2 = mysql_query($query, $db); //NUMERO DEI RECORDS DELLA TABELLA $records = mysql_num_rows($result); //QUI VIENE STAMPATA LA TABELLA $riga_db_tab2 = mysql_fetch_array($result2);{ echo "<table width=\"80%\" align=\"center\" cellspacing=\"2\" cellpadding=\"0\" border=\"0\"> <tr align=\"center\"><div align=\"center\" class=\"big_nero2\"><a href=\"mostra_speciale.php?id=$id_speciale\" alt=\"Torna allo speciale\" class=\"big_nero2\">$riga_db_tab2[nome_speciale] </a><span class=\"testonerohome\">(torna allo speciale)</span></div> </tr> <tr align=\"center\"><div align=\"center\">"; } //APERTURA PRIMO ARRAY $riga_db = mysql_fetch_array($result);{ //QUESTA FUNZIONE CREA UN ARRAY DEI DATI DELL'IMMAGINE //0 WIDTH="" //1 HEIGHT="" //2 MIME="" //3 HEIGHT="" WIDTH="" $size = getimagesize ($riga_db[img_big]); //TROVO LA DIMENSIONE WIDTH $width = $size[0]; $height = $size[1]; $mime = $size[2]; //APERTURA STAMPA IMMAGINE echo "<img src=\"$riga_db[img_big]\" border=\"7\" width=\""; //CREO LA CONDIZIONE DI RIDIMENSIONAMENTO DELLA WIDTH if ($width > 550){ echo "550"; }else{ echo $width; } //Query recupero dati utente $query_utente = "SELECT * FROM utenti WHERE id_utente='$id_utente'"; $result_utente = mysql_query($query_utente, $db); $dati_utente = mysql_fetch_array($result_utente);{ //CHIUSURA STAMPA IMMAGINE echo "\" alt=\"$riga_db_tab2[nome_speciale]\" class=\"bordolink\"></tr></table>"; echo " <span class=\"testonerohome\"></span>"; $query ="SELECT id_foto,id_speciale FROM fotospeciali where id_speciale=$id_speciale_passato AND id_foto>$id_foto_passato ORDER BY fotospeciali.id_foto Limit 1"; echo $query; $result =@mysql_query($query,$db); $id_max=@mysql_result($result,0,"id_foto"); $query ="SELECT id_foto,id_speciale FROM fotospeciali where id_speciale=$id_speciale_passato AND fotospeciali.id_foto<$id_foto_passato ORDER BY fotospeciali.id_foto DESC Limit 1"; $result = @mysql_query($query,$db); $id_min=@mysql_result($result,0,"id_foto"); //Se esiste la riga con fotospeciali.id_foto>'$id_foto_passato' crea il link "Foto Successiva" e lo mette nella variabile $links //Se invece non esiste, la variabile $links sarà vuota $links=(!empty($id_max))?"<a href=\"mostra_foto.php?id_speciale=$id_speciale_passato&id_foto=$id_max&id_utente=$id_utente\">Foto Successiva »</font></a>":""; //Se esiste la riga con fotospeciali.id_foto<'$id_foto_passato' crea il link "Foto precedente" e lo mette nella variabile $linkp //Se invece non esiste, la variabile $linkp sarà vuota $linkp=(!empty($id_min))?"<a href=\"mostra_foto.php?id_speciale=$id_speciale_passato&id_foto=$id_min&id_utente=$id_utente\">« Foto Precedente</font></a>":""; //La stampe delle due variabili la puoi fare dove vuoi echo"$linkp $links"; echo " <span class=\"testonerohome\"></span>"; //APERTURA TABELLA DATI IMMAGINI echo "<table align=\"center\" cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr align=\"left\"><td>"; echo "Il tuo click vale un voto! <span class=\"click\">Click attuali: $riga_db[click_foto]</span> </span> <span class=\"testonerohome\"> Immagine inviata da: $dati_utente[nome_utente] Autore dell'immagine:"; if ($riga_db[id_autore]==""){ echo " sconosciuto"; }else{ echo " $dati_utente[nome_utente]"; } if ($dati_utente[email_utente]!==""){ echo " <a href=\"mailto:".trim($dati_utente[email_utente])."\">Scrivi a $dati_utente[nome_utente]</a> "; }else{ echo ""; } echo "<a href=\"javascript:aprifinestra('info_utente.php?id=$dati_utente[id_utente]','info', 'width=300,height=250')\"> Informazioni su $dati_utente[nome_utente]</a>"; } } echo "</td><td width=\"30\"></td> <td><span class=\"testonerohome\"> Formato dell'immagine:"; if ($mime==1){ echo " GIF"; }else if ($mime==2){ echo " JPG"; } echo" Dimensioni reali immagine: L $width x A $height "; /***** IMPOSTA LA FUNZIONE CHE DETERMINA LA DIMENSIONE DEL FILE *****/ function GetSize ($sizeb) { $sizekb = $sizeb / 1024; $sizemb = $sizekb / 1024; $sizegb = $sizemb / 1024; $sizetb = $sizegb / 1024; $sizepb = $sizetb / 1024; if ($sizeb > 1) {$size = round ($sizeb, 0) . " b";} if ($sizekb > 1) {$size = round ($sizekb, 0) . " kb";} if ($sizemb > 1) {$size = round ($sizemb, 0) . " mb";} if ($sizegb > 1) {$size = round ($sizegb, 0) . " gb";} if ($sizetb > 1) {$size = round ($sizetb, 0) . " tb";} if ($sizepb > 1) {$size = round ($sizepb, 0) . " pb";} return $size; } $sizeb = filesize ("$riga_db[img_big]"); $peso_file = GetSize ($sizeb); echo "Peso del file: $peso_file</td> </span></tr></table> "; //QUERY DI UPDATE PER I CLICK $query2 = "UPDATE fotospeciali SET click_foto='".($riga_db[click_foto]+1)."' WHERE id_foto='$riga_db[id_foto]'"; $result3 = mysql_query($query2, $db); ?>

Rispondi quotando