} elseif ($a == 'reply') {
    $content = html_encode($_POST['content']);
    $author = html_encode($_POST['author']);
    $ip = $_SERVER['REMOTE_ADDR'];
    $reply_id = intval($_POST['id']);
    $row = array('content' => $content, 'author' => $author, 'ip' => $ip, 'reply_id' => $reply_id);
    $db->row_insert($db_reply_name, $row);
    $row = $db->row_select_one($db_article_name, 'id=' . $reply_id);
    // echo $row['reply_count'];
    $db->row_update($db_article_name, array('reply_count' => $row['reply_count'] + 1), 'id=' . $reply_id);
    header_go($_SERVER['PHP_SELF'] . '?a=view&id=' . $reply_id);
} elseif ($a == 'save') {
    $title = html_encode($_POST['title']);
    $content = html_encode($_POST['content']);
    $author = html_encode($_POST['author']);
    $ip = $_SERVER['REMOTE_ADDR'];
    $id = intval($_POST['id']);
    if ($id) {
        $row = array('title' => $title, 'content' => $content, 'author' => $author);
        $db->row_update($db_article_name, $row, 'id=' . $id);
    } else {
        $row = array('title' => $title, 'content' => $content, 'author' => $author, 'ip' => $ip);
        $db->row_insert($db_article_name, $row);
    }
    //echo $row['title'];
    header_go($_SERVER['PHP_SELF']);
} else {
    $row = $db->row_select($db_article_name);
    $smarty->assign("row", $row);
    $smarty->display('tieba/index_ref.tpl');
}
/**
 * 404页面跳转
 * @return void()
 * @author owen 2008-7-10
 */
function header_404()
{
    header("Status: 404 Not Found");
    header_go("/404.html");
}