Per voi sarà una passeggiata per me che non ci capisco molto non vi è una via di uscita..!!
Ho trovato questo script per i commenti:
tabella commenti:
codice:
CREATE TABLE `commenti` (
`id` int(11) NOT NULL auto_increment,
`data` varchar(15) NOT NULL default '',
`id_art` varchar(12) NOT NULL default '',
`tit_art` varchar(100) NOT NULL default '',
`commento` longtext NOT NULL,
`utente` varchar(40) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
(
Pagina di lettura e inserminto commento:
Codice PHP:
<?
$obj->connessione();
$dati=mysql_query("select * from commenti where id_art='$id' order by data desc");
while($array=mysql_fetch_array($dati)){
echo"$array[data] da ";
echo"<a href=mailto:$array[utente]>$array[utente]</a>
";
echo"$array[commento]
";
}
?>
<input type="button" value="link" onclick="document.theform.commento.innerHTML+='[a][/a]'">
<input type="button" value="codice" onclick="document.theform.commento.innerHTML+='[code][/code]'">
<input type="button" value="grassetto" onclick="document.theform.commento.innerHTML+='[b][/b]'">
<form method="post" action="savecomment.php" name="theform">
<input type="hidden" value="<?echo $id;?>" name="idart" >
<input type="hidden" value="<?echo $titolo;?>" name="titart">
Email :<input type="text" value="" name="email">
Commento:
<textarea rows=13 cols=60 name="commento"></textarea>
<input type="submit" value="Inserisci">
</form>
Pagina savecomment.php che elabora le info e le inserisce nella tabella:
Codice PHP:
<?
$data= date("d/m/y" ,time());
$new=$commento;
$new=str_replace("<?" ,"<?" ,$new);
$new=str_replace("<?php" ,"<?php" ,$new);
$new=str_replace("<" ,"<" ,$new);
$new=str_replace("[a]" ,"<a href=" ,$new);
$new=str_replace("[/a]" ,">link</a>" ,$new);
$new=str_replace("[code]" ,"<p class=codice>" ,$new);
$new=str_replace("[/code]" ,"</p>" ,$new);
$new=str_replace("[b]" ,"[b]" ,$new);
$new=str_replace("[/b]" ,"[/b]" ,$new);
$new = ereg_replace("
" ,"
" ,$new);
$dati=mysql_query("insert into commenti(data,id_art,tit_art,commento,utente) values ('$data','$idart','$titart','$new','$email')");
?>
Il problema è che non funge e credo che sia per il fatto che non vi sia inserito il codice per collegarsi al database..
Potete darmi una mano? Please..!!