kp3011 寫:functions_post.php 第 489 行 上 幾 行 有 一 行
SET user_posts = user_posts 0 WHERE user_id =
改 成
SET user_posts = user_posts - 1 WHERE user_id =
找了一下.並沒有發現這句...
還是想不出來哪裡有錯...
附上該檔案的程式碼..
麻煩大大幫忙看看
代碼: 選擇全部
function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$user_id)
{
global $db;
$sign = ($mode == 'delete') ? '- 1' : '+ 1';
///
/// Begin edit
///
$edited_sign = ($mode == 'delete') ? '0' : '+ 1';
///
/// End edit
///
$forum_update_sql = "forum_posts = forum_posts $sign";
$topic_update_sql = '';
if ($mode == 'delete')
{
if ($post_data['last_post'])
{
if ($post_data['first_post'])
{
$forum_update_sql .= ', forum_topics = forum_topics - 1';
}
else
{
$topic_update_sql .= 'topic_replies = topic_replies - 1';
$sql = "SELECT MAX(post_id) AS last_post_id
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
$topic_update_sql .= ', topic_last_post_id = ' . $row['last_post_id'];
}
}
if ($post_data['last_topic'])
{
$sql = "SELECT MAX(post_id) AS last_post_id
FROM " . POSTS_TABLE . "
WHERE forum_id = $forum_id";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
$forum_update_sql .= ($row['last_post_id']) ? ', forum_last_post_id = ' . $row['last_post_id'] : ', forum_last_post_id = 0';
}
}
}
else if ($post_data['first_post'])
{
$sql = "SELECT MIN(post_id) AS first_post_id
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id";
if (!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result))
{
$topic_update_sql .= 'topic_replies = topic_replies - 1, topic_first_post_id = ' . $row['first_post_id'];
}
}
else
{
$topic_update_sql .= 'topic_replies = topic_replies - 1';
}
}
else if ($mode != 'poll_delete')
{
$forum_update_sql .= ", forum_last_post_id = $post_id" . (($mode == 'newtopic') ? ", forum_topics = forum_topics $sign" : "");
$topic_update_sql = "topic_last_post_id = $post_id" . (($mode == 'reply') ? ", topic_replies = topic_replies $sign" : ", topic_first_post_id = $post_id");
}
else
{
$topic_update_sql .= 'topic_vote = 0';
}
$sql = "UPDATE " . FORUMS_TABLE . " SET
$forum_update_sql
WHERE forum_id = $forum_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
if ($topic_update_sql != '')
{
$sql = "UPDATE " . TOPICS_TABLE . " SET
$topic_update_sql
WHERE topic_id = $topic_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
}
if ($mode != 'poll_delete')
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts $edited_sign
WHERE user_id = $user_id";
if (!$db->sql_query($sql, END_TRANSACTION))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
}
return;
}
一個容易三心二意的女人...著迷於網站的製作,但又不專精...
從html.到asp,再跳cgi...一個因緣際會,邂逅了php....
才知自己的能力是多麼的膚淺~~~~Orz
近況:站長的心變成浮動ip.不定時罷工中.= =
目標:努力活下去,....^^"
-----------------------------------------
● (目前是租用虛擬主機架站)
●
++稜鏡之森++Prism Forest++
●
Ayano's Style Test Forum-綾乃的風格測試站
●
私の気まぐれな世界
++++自家主機使用++++
●架設主機作業系統:Windows11
●快速架站程式:XAMPP for Windows
●您的上網方式:ADSL 1G/600M
●您安裝的程式:Apache 2.4.58 + PHP 8.2.12 + MariaDB 10.4.32 + phpMyAdmin-5.2.1
●錯誤代碼及狀態:如說明