Codice PHP:
<?
$link = mysql_connect("localhost", "root", "") or die ("Impossibile connettersi a MySQL.");
mysql_select_db ("phpbb") or die ("Impossibile selezionare il database.");
$forum_id="3"; // ID del topic
$titolo="Titolo"; // Titolo del topic
$testo="Testo"; // Testo del topic
$username="Nome Amministratore"; // Username autore del topic
$ora=time()+7200; // Regolato per GMT+1
$sql="SELECT max(post_id) FROM posts";
$post_id=mysql_result(mysql_query($sql),0)+1;
$sql="SELECT max(topic_id) FROM topics";
$topic_id=mysql_result(mysql_query($sql),0)+1;
$sql="SELECT user_id FROM users WHERE username='$username'";
$username_id=mysql_result(mysql_query($sql),0);
$sql="SELECT user_posts FROM users WHERE user_id='$username_id'";
$user_posts=mysql_result(mysql_query($sql),0)+1;
$sql="SELECT forum_posts,forum_topics FROM forums WHERE forum_id='$forum_id'";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result)){
$forum_posts=$row[forum_posts]+1;
$forum_topics=$row[forum_topics]+1;
}
$sql="INSERT INTO posts (post_id,topic_id,forum_id,poster_id,post_time,poster_ip,post_username,enable_bbcode,enable_html,enable_smilies,enable_sig) VALUES ('$post_id','$topic_id','$forum_id','$username_id','$ora','','$username','1','0','1','0')";
mysql_query($sql);
$sql="INSERT INTO posts_text (post_id,bbcode_uid,post_subject,post_text) VALUES ('$post_id','5ba3675ddd','$titolo','$testo')";
mysql_query($sql);
$sql="INSERT INTO topics (topic_id,forum_id,topic_title,topic_poster,topic_time,topic_views,topic_replies,topic_status,topic_vote,topic_type,topic_first_post_id,topic_last_post_id,topic_moved_id) VALUES ('$topic_id','$forum_id','$titolo','$username_id','$ora','1','0','0','0','0','$topic_id','$topic_id','0')";
mysql_query($sql);
$sql="INSERT INTO topics_watch (topic_id,notify_status) VALUES ('$topic_id','1')";
mysql_query($sql);
$sql="UPDATE forums SET forum_posts='$forum_posts',forum_topics='$forum_topics',forum_last_post_id='$forum_last_post_id' WHERE forum_id='$forum_id'";
mysql_query($sql);
$sql="UPDATE users SET user_posts='$user_posts' WHERE user_id='$username_id'";
mysql_query($sql);
?>
..e funziona!