The topics I make with that script seems to always be "new posts". Any idea why this is? Or is it just a coincidence?

Edit:
After I logged out and in again, they were "read" as they should be.

So this is what I did from the code I found in post.php.

It does post a topic, but I want to know if it is correctly done.

I have no idea what $fid is.

require(PUN_ROOT . 'include/search_idx.php');

        $fid = 1;//isset($_GET['fid']) ? intval($_GET['fid']) : 0;
        $now = time();
        $hide_smilies = 1;
        $subject = "test subject";
        $message = "test message";

        // Create the topic
        $db->query('INSERT INTO ' . $db->prefix . 'topics (poster, subject, posted, last_post, last_poster, forum_id) VALUES(\'' . $db->escape($username) . '\', \'' . $db->escape($subject) . '\', ' . $now . ', ' . $now.', \'' . $db->escape($username) . '\', ' . $fid. ')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
        $new_tid = $db->insert_id();

        // Create the post ("topic post")
        $db->query('INSERT INTO ' . $db->prefix . 'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\'' . $db->escape($username) . '\', '.$pun_user['id'] . ', \'' . get_remote_address() . '\', \'' . $db->escape($message) . '\', \'' . $hide_smilies . '\', ' . $now . ', ' . $new_tid . ')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
        
        $new_pid = $db->insert_id();

        // Update the topic with last_post_id
        $db->query('UPDATE ' . $db->prefix . 'topics SET last_post_id=' . $new_pid.' WHERE id=' . $new_tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());

        update_search_index('post', $new_pid, $message, $subject);

        update_forum($fid);

Excuse me if I'm on the wrong forum, but this seemed to be the correct one for my question.

I am looking for a simple script to post a topic into a punbb forum (the forum is on my server and I have access to the MySQL database).

Any help is appreciated.