diff --git a/opt/post.php b/opt/post.php index 63e852c..71ff59e 100644 --- a/opt/post.php +++ b/opt/post.php @@ -364,10 +364,13 @@ function get_new_post_id($db, $sub) while ($row = $result->fetchArray(SQLITE3_NUM)) { $largest = "{$row[0]}"; } - + + $largest = filter($largest, 'num', 10); + // more than 10 digits are not necessary for a post_id + $largest++; // we increase the largest number by one to get the new post_id - + return $largest; } @@ -450,7 +453,8 @@ function make_edit($db, $sub, $post_id, $ip, $settings) $text = strip_tags($_POST['edit_text']); $text_id = hash('sha512', $text); - $global_id = hash('sha512', $sub . $new_post_id . $org_id . $text); + $global_id = hash('sha512', $sub . $new_post_id . + $settings['site_name'] . $text); $edit_message = 'edited by user, click "edit" to see the history'; $statement = $db->prepare("INSERT INTO threads(post_id, sub, text, @@ -519,7 +523,8 @@ function make_post($db, $sub, $settings, $text, $org_id) quit($db, "