Allora, secondo quel tutorial, fai quello che ti dico:
Entra nel phpmyadmin
Seleziona la tabella del forum (menù sx)
Clicca su SQL (menù in alto)
Copia-incolla questo codice:
Codice PHP:
CREATE TABLE `shoutbox` (
`postid` int(11) NOT NULL auto_increment,
`poster` varchar(45) NOT NULL default '',
`message` varchar(255) NOT NULL default '',
`date` int(11) unsigned NOT NULL default '0',
`ipadress` varchar(15) NOT NULL default '',
PRIMARY KEY (`postid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Dopo aver cliccato su esegui,
crea un file denominato shoutbox.php dove copi e incolli questo codice:
Codice PHP:
<?php
/**************************************************************/
//| |//
//| Fast Shout Box Script 0.1 |//
//| © RevokeSoft 2006 |//
//| Author : trashofmasters |//
//| Date : 1146068386 |//
//| |//
/**************************************************************/
//limit : INTEGER / NULL if NULL show all messages else show N messages
//dbname: database name
//pass : database password
//host : database host , usually ( 90% cases ) localhost
//user : database username
//lunghezza_minima : INTEGER the minium lenght ( in characters ) of the username and message
//message_default_value : show the default value for message
//username_default_value : show the default value for username
/**********************************************/
/**/ #EDIT UNDER HERE# /**/
/**********************************************/
/**/ $message_default_value = 'Messaggio'; /**/
/**/ $username_default_value = 'Username'; /**/
/**/ $lunghezza_minima = 10; /**/
/**/ $dbname = ''; /**/
/**/ $user = ''; /**/
/**/ $pass = ''; /**/
/**/ $host = 'localhost'; /**/
/**/ $limit = NULL; /**/
/**********************************************/
//connecting to the database
$connection = mysql_connect($host,$user,$pass);
$database = mysql_select_db($dbname,$connection);
if($limit == NULL){
$limit = '';
}else{
$limit = 'LIMIT '.$limit;
}
//extracting messages from the database
$query = 'SELECT * FROM shoutbox ORDER BY date DESC '.$limit;
$select = mysql_query($query);
//check if the form is correctly filled and if the submit button was pressed
if($_GET['act'] == 'post' ){
//check if the directive magic_quotes_gpc is set to 1 in php.ini
//if not escapes all special characters
//else do anything
if(!get_magic_quotes_gpc()){
$poster = addslashes($_POST['username']);
$message = addslashes($_POST['message']);
}else{
$poster = $_POST['username'];
$message = $_POST['message'];
}
//check if the fields are filled
if(empty($poster) or empty($message)){
$error .= '<p class="error">Impossibile Inserire Il Messaggio : Campi Vuoti!</p>';
}
//check if the field are more than $lunghezza_minima characters
if(strlen($poster) < $lunghezza_minima or strlen($message) < $lunghezza_minima){
$error .= '<p class="error">Impossibile Inserire Il Messaggio : Minimo '.$lunghezza_minima.' Caratteri!</p>';
}
//check if the form is submitted only by pressing submit
if($poster == $username_default_value or $message == $message_default_value){
$error .= '<p class="error">Impossibile Inserire Il Messaggio : Valori Di Default Non Ammessi!</p>';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>shout box</title>
<style type="text/css">
.textarea {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #3C6180;
text-decoration: none;
width: 150px;
padding: 1px;
vertical-align: middle;
border: 2px solid #B3CADD;
}
.shout {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #009900;
}
.cancel {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #CC0000;
}
.username {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #006699;
}
.scrollarea {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
background-color: #CBDBE4;
border: 2px solid #B3CADD;
width: 150px;
padding: 2px;
}
.success {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #006600;
background-color: #C4F5BC;
border: 1px solid #009900;
width: 150px;
padding: 2px;
}
.error {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #CC0000;
background-color: #F4BDBD;
border: 1px solid #CC0000;
width: 150px;
padding: 2px;
}
a{
text-decoration: none;
}
</style>
</head>
<body>
<form id="shoutpost" method="post" action="?act=post">
<table width="162" border="0" cellpadding="1" cellspacing="1">
<tr>
<td width="156" class="scrollarea" style="vertical-align: top; height: 200px;">
<marquee direction="up " scrollamount="1">
<?php
//fetching the messages
while($shout = mysql_fetch_array($select)){
//un-escape the string
if(get_magic_quotes_gpc()) {
$mex = stripslashes($shout['message']);
}else{
$mex = $shout['message'];
}
//show the messages and convert them timestamp into a human readable date
echo '<span class="username">'.$shout['poster'].'</span> : <br />'.$mex.'<br />'.date('d/m/Y H:i:s',$shout['date']).'<br />'; }
?>
</marquee></td>
</tr>
<tr>
<td><input name="username" type="text" class="textarea" id="username" onfocus="this.value=('')" value="<?php echo $username_default_value; ?>" size="80"/></td>
</tr>
<tr>
<td><input name="message" type="text" class="textarea" id="messaggio" onfocus="this.value=('')" value="<?php echo $message_default_value; ?>" maxlength="255"/></td>
</tr>
<tr>
<td><input name="Submit" type="submit" class="shout" value="Urla" />
<input name="Submit2" type="reset" class="cancel" value="Cancella" /></td>
</tr>
</table>
</form>
<?php
//check if there is any error
if(!empty($error))
{
echo $error;
}elseif(isset($_POST['Submit'])){
//if there aren't submit data into database
$query = "INSERT INTO shoutbox (poster,message,date,ipadress) VALUES ('".$poster."','".$message."','".time()."','".$_SERVER['REMOTE_ADDR']."');";
$ins = mysql_query($query);
if($ins)
{
//success message
echo '<p class="success">Messaggio Inserito Con Successo <a href='.$_SERVER['PHP_SELF'].'>aggiorna</a></p>';
}
}
?>
</body>
</html>
Adesso, dove vorrai far apparire la tua tag board, inserirai questo codice:
Codice HTML:
<iframe name="shoutbox" src="shoutbox.php" FrameBorder="0" MarginHeight="0" MarginWidth="0" with="156" height="200">
Spero sia stato chiaro, ciao e auguri.