Ho appena scritto un codice per il mio sito che metto a disposizione della comunitą di coppermine!

Si tratta di far visualizzare in modo random, nome album, foto in miniatura, commento e autore.
Es.
Estate 2006
(Spagna)
[thumb_foto001.jpj]
Commento:
Autore:
Dopo aver inserito i dati del vostro database sul quale č installato coppermine, potete inserite il codice in una qualsiasi parte o pagina (php) del vostro sito.
Per qualsiasi info/suggerimento/dubbio/consiglio ecc. postate ESCLUSIVAMENTE in questo thread.
P.S.: Il codice č stato testato su cpg1.4.12 con il plugin SEF, fate attenzione al suffiso del vostro database, il mio č cpg143_ quindi se dovesse essere diverso cambiatelo in ogni parte del codice.
<?php
//inserisci i dati del db
$db_host = "host";
$db_user = "username";
$db_password = "password";
$db_database = "database";
$xxx = mysql_connect($db_host,$db_user,$db_password);
mysql_select_db($db_database,$xxx);
$sel = mysql_query("SELECT msg_id FROM cpg143_comments ORDER BY rand() LIMIT 1");
$seleziona = mysql_fetch_array($sel);
$numero = $seleziona[0];
$comm = mysql_query("SELECT msg_body FROM cpg143_comments WHERE (msg_id=$numero)");
$commento = mysql_fetch_array($comm);
$commento = $commento[0];
$result2 = mysql_query("SELECT pid FROM cpg143_comments WHERE (msg_id=$numero)");
$foto = mysql_fetch_array($result2);
$foto = $foto[0];
$result3 = mysql_query("SELECT msg_author FROM cpg143_comments WHERE (msg_id=$numero)");
$autore = mysql_fetch_array($result3);
$autore = $autore[0];
$result4 = mysql_query("SELECT filepath filename FROM cpg143_pictures WHERE (pid=$foto)");
$fp = mysql_fetch_array($result4);
$fp = $fp[0];
$result5 = mysql_query("SELECT filename FROM cpg143_pictures WHERE (pid=$foto)");
$fn = mysql_fetch_array($result5);
$fn = $fn[0];
$result6 = mysql_query("SELECT aid FROM cpg143_pictures WHERE (pid=$foto)");
$alb = mysql_fetch_array($result6);
$alb = $alb[0];
$result7 = mysql_query("SELECT title FROM cpg143_albums WHERE (aid=$alb)");
$album = mysql_fetch_array($result7);
$album = $album[0];
$tumb = 'thumb_';
echo "<table width=170 align=center bgcolor=black>
<tr>
<td>
<center><font color=\"yellow\" size=\"2\" face=\"Verdana\"><b>$album</b><br></font></center>
</td>
</tr>
<tr>
<td>
<center><img src=/foto/albums/$fp$tumb$fn alt='$album' border='0' style='border: 1px solid #FFFFFF'><br></center>
</td>
</tr>
<tr>
<td>
<center><font color=\"white\" size=\"2\" face=\"Verdana\"><b>Commento:</b> {$commento}<br><br></font></center>
</td>
</tr>
<tr>
<td>
<center><font color=\"white\" size=\"2\" face=\"Verdana\"><b>Autore:</b> {$autore}<br></font></center>
</td>
</tr>
<tr>
<td>
<center><font color=\"white\" size=\"2\" face=\"Verdana\"><a href=\"/foto/displayimage-$foto.html\">Vai alla foto!</a><br></font></center>
</td>
</tr>
</table>";
?>