in tempo quasi record, eccoti la soluzione!
scusami per la spartanità del codice (indenting praticamente inesistente, confusione generale, ecc), ma ho fatto il più presto possibile e non mi sono curato di questi dettagli.
sono necessari soltanto 2 files php, una tabella nel database ed ovviamente una pagina su cui far girare il codice.
allora, prima di tutto crea la tabella nel tuo database.
per farlo, vai nel tuo phpmyadmin e fai eseguire questo codice sql:
CREATE TABLE `effebox` (
`id` int(10) unsigned NOT NULL auto_increment,
`data` varchar(16) NOT NULL default '',
`autore` varchar(20) NOT NULL default '',
`testo` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
adesso crea un file chiamato "mess.php". è da lì che gli utenti potranno inserire i messaggi.
<?
define('DBHOST', "localhost");
define('DBNAME', "mysql");
define('DBUSER', "root");
define('DBPASS', "");
$conn=mysql_connect(DBHOST,DBUSER,DBPASS)
or die("Errore nella connessione");
mysql_select_db(DBNAME)
or die("Database non trovato");
// TI CONSIGLIO VIVAMENTE DI CAMBIARE GLI STYLES!!!!!!!!
$body = "background-color:white;color:black;font-family:verdana;font-size:11;margin:2px";
//inserisci
if ($_POST["invia"])
{
foreach($_REQUEST as $key => $value)
$$key=$value;
$data=time();
$testo=str_replace("\"", """, $testo);
$testo=str_replace("<", "<", $testo);
$testo=str_replace(">", ">", $testo);
$testo=str_replace("& ", "& ", $testo);
$testo=addslashes($testo);
$query="
INSERT INTO `effebox` (`id` , `data` , `autore` , `testo`)
VALUES
(
'',
'$data',
'$autore',
'$testo'
);";
$esegui=@mysql_query($query);
if ($esegui) $stato="Messaggio inserito<br>[ <a href=\"javascript:self.close();\">Chiudi</a> ]";
else die("ERRORE!!");
mysql_close($conn);
echo "<html>
<head>
<title>Invia un messaggio</title>
</head>
<body style=\"$body\">
<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"5\">
<tr>
<td align=center><b>$stato</b></td>
</tr>
</table></body></html>
";
}
else
//pagina inserimento
{
echo "
<html>
<head>
<title>Invia un messaggio</title>
<style type=\"text/css\">
<!--
a:link {
color:blue; text-decoration: none;
}
a:visited {
color:blue; text-decoration: none;
}
a:hover {
color:red; text-decoration: underline;
}
a:active {
color:blue; text-decoration: none;
}
-->
</style>
<script language=\"JavaScript\">
<!--
function calcCharLeft(f,l1) {
var msgLen;
var MaxLength;
MaxLength = 100;
msgLen=document.modulo.testo.value.length;
if (msgLen >= MaxLength ){
document.modulo.charsleft.value= \"0\";
window.alert(\"Messaggio troppo lungo!\");
document.modulo.testo.value=document.modulo.testo.value.substring(0,MaxLength);
}
else {
document.modulo.charsleft.value = MaxLength - msgLen;
}
}
// -->
</script>
</head>
<body style=\"$body\">
<!-- INIZIO CODICE TESTO SCORREVOLE -->
<FORM name=\"modulo\" method=\"post\" action=\"mess.php\">
<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"5\">
<tr>
<td align=center><b>Pubblica il tuo messaggio!</b></td>
</tr>
<tr>
<td align=center>
Autore: <input type=\"text\" name=\"autore\" size=\"30\" maxlength=\"15\"></td>
</tr>
<tr>
<td align=center>
<textarea name=\"testo\" rows=\"3\" cols=\"20\" OnKeyUp=\"calcCharLeft()\" OnChange=\"calcCharLeft()\"></textarea>
</td>
</tr>
<tr>
<td align=center>
<input type=\"text\" readonly name=\"charsleft\" size=\"3\" value=\"100\"> caratteri rimanenti.
</td>
</tr>
<tr>
<td align=center>
<input type=\"submit\" value=\"Invia!!\" name=\"invia\"></td>
</tr>
</table>
</body>
</html>
";
}
?>
poi crea un file chiamato "minibox.php"... questo conterrà invece i messaggi a scorrimento.
<?
define('DBHOST', "localhost");
define('DBNAME', "mysql");
define('DBUSER', "root");
define('DBPASS', "");
/*
CONFIGURAZIONE DELLA TAG BOARD
------------------------------
Modifica questi parametri a tuo piacimento! :)
*/
//default: sfondo=bianco, testo:nero, font=verdana, dimensione=11, margini=2px
$body = "background-color:white;color:black;font-family:verdana;font-size:11;margin:2px";
//default: ritardo=100 - diminuire per velocizzare...
$marquee = "scrolldelay=\"100\"";
//numero max di messaggi da mostrare
$messaggi = 15;
echo "<html><head><title>EffeBox - messaggi</title></head>
<body style=\"$body\">
<marquee $marquee width=\"100%\">";
$conn=mysql_connect(DBHOST,DBUSER,DBPASS)
or die("Errore nella connessione");
mysql_select_db(DBNAME)
or die("Database non trovato");
$sql = mysql_query("select * from effebox order by `id` limit 0, $messaggi");
while ($result=mysql_fetch_array($sql))
{
$timestamp=$result['data'];
$d = date("j", $timestamp);
$mn = date("n", $timestamp);
$y = date("Y", $timestamp);
$hr = date("H", $timestamp);
$min = date("i", $timestamp);
$sec = date("s", $timestamp);
$data="$d/$mn/$y - $hr:$min.$sec";
$user=$result['autore'];
$messaggio=$result['testo'];
echo "<u>$data</u> » <b>$user</b>: $messaggio || ";
}
echo "</marquee></body></html>";
?>
e adesso non ti resta che provarlo!
ecco una pagina di prova (che ho semi-copiato dalla pagina che hai citato tu):
<html>
<head>
<title>Pagina di esempio per tagboard</title>
</head>
<body>
bla bla bla
<table><tr><td width=50%>
<iframe name="frame" src="minibox.php" height="15" width="100%" border="0" frameborder="0" scrolling="no">
IFRAMES non supportati dal browser</iframe></td>
<td>
<a href="javascript:var remote=window.open('mess.php','newWin','width=285,height=280,top=50, left=160,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no, resizeable=no');">
INSERISCI IL TUO![/url]</td></tr></table>
altro testo
</body>
</html>
CONCLUSIONI:
devi personalizzare il più possibile i files... qua e là troverai delle informazioni. ovviamente più lo rendi "tuo", meglio è.... io ad esempio ho anche copiato la funziona che fa il conto alla rovescia dei caratteri disponibili, ma soltanto per una questione di fretta. tu, se puoi, modificalo... cambia i colori, qualche dettagliuccio, ecc...
spero di esserti stato utile, in qualche modo. ...e fammi sapere se funge!
ora credo che andrò proprio a farmi una bella dormita :rolleyes:
alla prox!