<?php
//хостинг
$sqlhost="localhost";
//имя пользователя
$sqluser="root";
//пароль
$sqlpass="";
//имя БД
$db="phpbb_forum";
//Подключаемся к MySQL
mysql_connect($sqlhost, $sqluser, $sqlpass) or die ("MySQL не доступен!".mysql_error());
//Подключаемся к БД
mysql_select_db($db) or die ("Нет соединения с БД!".mysql_error());
$prefix="phpbb_";
$timenow = time();
$forumid=2;
$title="My Topic";
$postuserid=2;
$userip="";
$posttext="Post Text";
$topicfirstpostername="admin";
$topicfirstpostercolour="AA0000";
$topiclastposterid=2;
// create new thread
mysql_query("INSERT INTO " .$prefix."topics (forum_id, topic_title, topic_poster, topic_time, topic_first_poster_name, topic_first_poster_colour, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time, topic_last_view_time, topic_last_post_subject)
VALUES ('" . $forumid . "', '$title', $postuserid, $timenow,'$topicfirstpostername','$topicfirstpostercolour',$topiclastposterid,'$topicfirstpostername','$topicfirstpostercolour',$timenow,$timenow, '$title')");
$topic_id = mysql_insert_id();
// create new post
mysql_query("INSERT INTO " . $prefix."posts (topic_id, forum_id, poster_id, post_time, poster_ip, enable_sig, post_text, post_subject )
VALUES ($topic_id, '" . $forumid . "', $postuserid, $timenow, '$userip', 1, '$posttext', '$title')");
$postid = mysql_insert_id();
// update thread
mysql_query("UPDATE " . $prefix . "topics SET topic_first_post_id = $postid,
topic_last_post_id = $postid
WHERE topic_id = $topic_id");
// update user
mysql_query("UPDATE " . $prefix . "users SET user_lastvisit = $timenow,
user_posts = (user_posts + 1)
WHERE user_id = $postuserid");
// update forum
mysql_query("UPDATE " . $prefix . "forums SET forum_posts = (forum_posts + 1),
forum_topics = (forum_topics + 1),
forum_topics_real =(forum_topics_real +1),
forum_last_post_subject = '$title',
forum_last_post_id = $postid
WHERE forum_id = '".$forumid."'");
?>