Originariamente inviato da antos
posta l'html della pagina
ti posto tutta la pgina ( nn è lunga ) perchè molto hmtl lo faccio scrivere a php :
codice:
<html>
<head>
<title>Piero06's Guestbook 1.0</title>
<script type="text/javascript">
<!--
function PopupCentrata(arg) {
var w = 400;
var h = 350;
var l = Math.floor((screen.width-w)/2);
var t = Math.floor((screen.height-h)/2);
window.open("profili.php?id="+arg,"","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
}
//-->
</script>
<link rel='stylesheet' href='style.css' type='text/css'>
</head>
<body>
<p align="center">Piero06's Guestbook 1.0</p>
<p align="center"> </p>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="15%"></td>
<td width="70%">
<p align="center">Ecco il messaggi che risiedono del db del Guestbook!
</td>
<td width="15%"> </td>
</tr>
<tr>
<td width="15%"></td>
<td width="70%">
<?
// i dati per la connesione
$db_host = "localhost";
$db_user = "piero06";
$db_password = "inter02";
$db_name = "guestbook";
// connesione al db
$db = mysql_connect($db_host, $db_user, $db_password);
// verifca della connesione
if ($db == FALSE) {
die ("Errore nella connessione. Verificare i parametri nel file config.inc.php");
}
mysql_select_db("$db_name");
// esecuzione prima query
$count = mysql_query("SELECT COUNT(id) FROM guestbook");
$res_count = mysql_fetch_row($count);
// numero totale di records
$tot_records = $res_count[0];
// risultati per pagina(secondo parametro di LIMIT)
$per_page = 3;
// numero totale di pagine
$tot_pages = ceil($tot_records / $per_page);
// pagina corrente
$current_page = (!$_GET['page']) ? 1 : (int)$_GET['page'];
// primo parametro di LIMIT
$primo = ($current_page - 1) * $per_page;
echo "<table border=\"0\" width=\"100%\" style=\"border: 1 solid #000000\" cellspacing=\"0\" cellpadding=\"0\"> \n";
// esecuzione seconda query con LIMIT
$query_limit = mysql_query("SELECT * FROM guestbook LIMIT $primo, $per_page");
while($results = mysql_fetch_array($query_limit)) {
$data = date('d/m/Y',$row['DATA']);
$time = date('H:i:s',$row['DATA']);
echo "<tr>
<td width=\"33%\" onMouseOver=\"this.className='due'\" onMouseOut=\"this.className=''\" style=\"background-color: #C0C0C0; color: #FF0000; border-bottom: 1 solid #000000\">Inviato da : <a href=\"#\" onclick=\"PopupCentrata('".$results['id']."');\">" . $results['nome'] . " " . $results['cognome'] . "</a>[/b]</td>
<td width=\"33%\" style=\"background-color: #C0C0C0; color: #FF0000; border-bottom: 1 solid #000000\"> </td>
<td width=\"34%\" style=\"background-color: #C0C0C0; color: #FF0000; border-bottom: 1 solid #000000\">il ".$data." alle ".$time." </td>
</tr>
<tr>
<td width=\"100%\" colspan=\"3\">Messaggio : " .$results['testo'] . "</td>
</tr>
<tr>
<td width=\"33%\" style=\"background-color: #CCCCCC; color: #000000\"> </td>
<td width=\"33%\" style=\"background-color: #CCCCCC; color: #000000\"> </td>
<td width=\"34%\" style=\"background-color: #CCCCCC; color: #000000\"><a href=mailto:".$results['email'] ."><img src=\"immagini/contattaci.gif\" border=\"0\"> Email </a> <img src=\"immagini/home.gif\" border=\"0\">home</td>
</tr>
<tr>
<td width=\"100%\" colspan=\"3\" style=\"border-bottom: 1 solid #000000\"></td>
</tr>
";
}
include("paginazione.php");
echo " <tr>\n <td height=\"50\" valign=\"bottom\" align=\"center\">$paginazione</td>\n";
echo " </tr>
</table>";
mysql_close();
?>
</td>
<td width="15%"></td>
</tr>
<tr>
<table border="0" width="100%">
<tr>
<td width="50%" align="center" height="18"><font face="Arial" size="2"><u><a href="index.html">Nuovo
Messaggio</a></u></font></td>
<td width="50%" align="center" height="18"><font face="Arial" size="2"><u>[b]<a href="leggi.php">Visualizza
i messaggi</a>[/b[</u></font></td>
</tr>
</table>
</tr>
<tr>
<td width="15%"></td>
<td width="70%"></td>
<td width="15%"></td>
</tr>
</table>
</body>
</html>
in grassetto i link che nn vanno