ich möchte ein neues Topic für einen kleinen MOD direkt über ein mysql query erstellen.
Kann bitte man jemand kurz über den Code kucken, und mir ein paar kleine Fragen zu einzelnen Einträgen beantworten.
Auch über "Hilfe zur Selbsthilfe" wäre ich sehr dankbar (d.h. in welchem File muss ich suchen um zu sehen wie das die Forensoftware tut)
1) neues Topic erstellen, und topic-id (Auto increment) merken
Code: Alles auswählen
$sql = "INSERT INTO `phpbb_topics`
(`forum_id`, `topic_title`, `topic_poster`, `topic_time`, `topic_first_poster_name`, `topic_last_poster_id`, `topic_last_poster_name`, `topic_last_post_time`, `topic_last_view_time`)
VALUES
('23','$titel','$name ','$time','$name ','4','$name ','$time','$time')";
mysql_query($sql,$db);
$topic_id = str_replace('Resource id #','',mysql_insert_id());
Code: Alles auswählen
$sql = "INSERT INTO `phpbb_posts`
(`topic_id`, `forum_id`, `poster_id`, `poster_ip`, `post_time`, `post_subject` ,`post_text` ,`post_checksum` ,`bbcode_uid`)
VALUES
('$topic_id','23','4','$ip','$time','$titel','$text ','','')";
mysql_query($sql,$db);
$post_id = str_replace('Resource id #','',mysql_insert_id());
Code: Alles auswählen
$sql = "UPDATE `phpbb_topics` SET
`topic_first_post_id`= '$post_id', `topic_last_post_id`= '$post_id'
WHERE
`topic_id` = '$topic_id'";
mysql_query($sql,$db);
Code: Alles auswählen
$sql = "UPDATE `phpbb_users`
SET `user_posts` = `user_posts`+1 WHERE `user_id` = '4'";
mysql_query($sql,$db);
Code: Alles auswählen
$sql = "INSERT INTO `phpbb_topics_posted`
(`user_id`, `topic_id`, `topic_posted`)
VALUES
('4', '$topic_id', '1')";
mysql_query($sql,$db);
Code: Alles auswählen
$sql = "UPDATE `phpbb_forums`
SET `forum_posts` = `forum_posts`+1,
`forum_topics` = `forum_topics`+1,
`forum_topics_real` = `forum_topics_real`+1,
`forum_last_post_id` = '$forum_post_id',
`forum_last_poster_name` = '$forum_name',
`forum_last_post_time` = '$forum_time',
`forum_last_post_id` = '$forum_post_id',
`forum_last_poster_id` = '$forum_userid',
`forum_last_post_subject` = '$forum_titel'
WHERE `forum_id` = '$forum_forumid'";
mysql_query($sql,$db);
a) ob ich doch noch etwas falsch mache
und
b) was post_checksum und bbcode_uid in der Tabelle phpbb_posts` bedeuten, bzw. wie ich die Einträge berechne ?
Scheint wohl relevant zu sein, wenn ich bbCode verwenden will (was ich will, und was derzeit noch nicht geht)
Ich fände jeden Hinweis echt klasse!
Grüße, Geoemyda