<?php
/**
* @author moufer<moufer@163.com>
* @copyright www.modoer.com
* @version $Id 3 2008-08-25 18:35 $
*/
!defined('IN_MUDDER') && exit('Access Denied');

if(!check_submit('mysubmit')) {

    $subtitle = '我的留言板';
    $total = $db->get_value("SELECT COUNT(*) FROM {$dbpre}gbooks WHERE uid='{$user->uid}'");
    if($total > 0) {
        $limit = get_limit($page, 10);
        $query = $db->query("SELECT * FROM {$dbpre}gbooks WHERE uid='{$user->uid}' ORDER BY posttime LIMIT $limit");
        while($gbook = $db->fetch_array($query)) {
            $gbook['posttime'] = date('Y-m-d', $gbook['posttime']);
            $gbook['content'] = strip_textarea($gbook['content']);
            $gbooks[] = $gbook;
        }
        $multipage = multi($total, $offset, $page, "{$_modules['space']['url']}index.php?suid=$suid&n=gbook");
    }

} else {

    if(!is_array($gbookIds)||count($gbookIds)<=0){
        redirect('未选择，请返回修改，至少选择一项。');
    } else {
        foreach($gbookIds as $gbookId){
            $db->update("DELETE FROM {$dbpre}gbooks WHERE gid='$gbookId' AND uid='{$user->uid}'");
        }
        redirect('删除完毕！',"index.php?ac=$ac");
    }

}
?>