コード例 #1
0
ファイル: function_delete.php プロジェクト: NaturalWill/UCQA
function deletespace($uid, $force = 0)
{
    global $_SGLOBAL, $_SC, $_SCONFIG;
    $delspace = array();
    $allowmanage = checkperm('managedelspace');
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('space') . " WHERE uid='{$uid}'");
    if ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($force || $allowmanage && $value['uid'] != $_SGLOBAL['supe_uid']) {
            $delspace = $value;
            //如果不是强制删除则入删除记录表
            if (!$force) {
                $setarr = array('uid' => $value['uid'], 'username' => saddslashes($value['username']), 'opuid' => $_SGLOBAL['supe_uid'], 'opusername' => $_SGLOBAL['supe_username'], 'flag' => '-1', 'dateline' => $_SGLOBAL['timestamp']);
                inserttable('spacelog', $setarr, 0, true);
            }
        }
    }
    if (empty($delspace)) {
        return array();
    }
    //履盖权限设置
    $_SGLOBAL['usergroup'][$_SGLOBAL['member']['groupid']]['managebatch'] = 1;
    //space
    $_SGLOBAL['db']->query("DELETE FROM " . tname('space') . " WHERE uid='{$uid}'");
    //spacefield
    $_SGLOBAL['db']->query("DELETE FROM " . tname('spacefield') . " WHERE uid='{$uid}'");
    //feed
    $_SGLOBAL['db']->query("DELETE FROM " . tname('feed') . " WHERE uid='{$uid}' OR (id='{$uid}' AND idtype='uid')");
    //记录
    $doids = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('doing') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $doids[$value['doid']] = $value['doid'];
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('doing') . " WHERE uid='{$uid}'");
    //删除记录回复
    $_SGLOBAL['db']->query("DELETE FROM " . tname('docomment') . " WHERE doid IN (" . simplode($doids) . ") OR uid='{$uid}'");
    //分享
    $_SGLOBAL['db']->query("DELETE FROM " . tname('share') . " WHERE uid='{$uid}'");
    //数据
    $_SGLOBAL['db']->query("DELETE FROM " . tname('album') . " WHERE uid='{$uid}'");
    //删除积分记录
    $_SGLOBAL['db']->query("DELETE FROM " . tname('creditlog') . " WHERE uid='{$uid}'");
    //删除通知
    $_SGLOBAL['db']->query("DELETE FROM " . tname('notification') . " WHERE (uid='{$uid}' OR authorid='{$uid}')");
    //删除打招呼
    $_SGLOBAL['db']->query("DELETE FROM " . tname('poke') . " WHERE (uid='{$uid}' OR fromuid='{$uid}')");
    //删除他仓建的投票
    $pollid = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('poll') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pollid[$value['pid']] = $value['pid'];
    }
    deletepolls($pollid);
    //删除他参与的投票
    $pollid = array();
    $query = $_SGLOBAL['db']->query("SELECT pid FROM " . tname('polluser') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pollid[$value['pid']] = $value['pid'];
    }
    //扣除投票数
    if ($pollid) {
        $_SGLOBAL['db']->query("UPDATE " . tname('poll') . " SET voternum=voternum-1 WHERE pid IN (" . simplode($pollid) . ")");
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('polluser') . " WHERE uid='{$uid}'");
    //活动
    $ids = array();
    $query = $_SGLOBAL['db']->query('SELECT eventid FROM ' . tname('event') . " WHERE uid = '{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $ids[] = $value['eventid'];
    }
    deleteevents($ids);
    //删除他参加的活动
    $ids = $ids1 = $ids2 = array();
    $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('userevent') . " WHERE uid = '{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($value['status'] == 1) {
            $ids1[] = $value['eventid'];
            //关注
        } elseif ($value['status'] > 1) {
            $ids2[] = $value['eventid'];
            //参加
        }
        $ids[] = $value['eventid'];
    }
    if ($ids1) {
        $_SGLOBAL['db']->query('UPDATE ' . tname('event') . ' SET follownum = follownum - 1 WHERE eventid IN (' . simplode($ids1) . ')');
    }
    if ($ids2) {
        $_SGLOBAL['db']->query('UPDATE ' . tname('event') . ' SET membernum = membernum - 1 WHERE eventid IN (' . simplode($ids2) . ')');
        // to to: 最好还要检查并减去他携带的人数
    }
    if ($ids) {
        $_SGLOBAL['db']->query('DELETE FROM ' . tname('userevent') . ' WHERE eventid IN (' . simplode($ids) . ") AND uid = '{$uid}'");
    }
    //删除相关活动邀请
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('eventinvite') . " WHERE uid = '{$uid}' OR touid = '{$uid}'");
    //删除上传的活动图片
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('eventpic') . " WHERE picid = '{$uid}'");
    //to do: 最好同时更新活动图片数和活动话题数
    //道具
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('usermagic') . " WHERE uid = '{$uid}'");
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('magicinlog') . " WHERE uid = '{$uid}'");
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('magicuselog') . " WHERE uid = '{$uid}'");
    //pic
    //删除图片附件
    $pics = array();
    $query = $_SGLOBAL['db']->query("SELECT filepath FROM " . tname('pic') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pics[] = $value;
    }
    //数据
    $_SGLOBAL['db']->query("DELETE FROM " . tname('pic') . " WHERE uid='{$uid}'");
    //blog
    $blogids = array();
    $query = $_SGLOBAL['db']->query("SELECT blogid FROM " . tname('blog') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $blogids[$value['blogid']] = $value['blogid'];
        //tag
        $tags = array();
        $subquery = $_SGLOBAL['db']->query("SELECT tagid, blogid FROM " . tname('tagblog') . " WHERE blogid='{$value['blogid']}'");
        while ($tag = $_SGLOBAL['db']->fetch_array($subquery)) {
            $tags[$tag['tagid']] = $tag['tagid'];
        }
        if ($tags) {
            $_SGLOBAL['db']->query("UPDATE " . tname('tag') . " SET blognum=blognum-1 WHERE tagid IN (" . simplode($tags) . ")");
            $_SGLOBAL['db']->query("DELETE FROM " . tname('tagblog') . " WHERE blogid='{$value['blogid']}'");
        }
    }
    //数据删除
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blog') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blogfield') . " WHERE uid='{$uid}'");
    //bwzt
    $bwztids = array();
    $query = $_SGLOBAL['db']->query("SELECT bwztid FROM " . tname('bwzt') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $bwztids[$value['bwztid']] = $value['bwztid'];
        //tag
        $tags = array();
        $subquery = $_SGLOBAL['db']->query("SELECT tagid, bwztid FROM " . tname('tagbwzt') . " WHERE bwztid='{$value['bwztid']}'");
        while ($tag = $_SGLOBAL['db']->fetch_array($subquery)) {
            $tags[$tag['tagid']] = $tag['tagid'];
        }
        if ($tags) {
            $_SGLOBAL['db']->query("UPDATE " . tname('tag') . " SET bwztnum=bwztnum-1 WHERE tagid IN (" . simplode($tags) . ")");
            $_SGLOBAL['db']->query("DELETE FROM " . tname('tagbwzt') . " WHERE bwztid='{$value['bwztid']}'");
        }
    }
    //数据删除
    $_SGLOBAL['db']->query("DELETE FROM " . tname('bwzt') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('bwztfield') . " WHERE uid='{$uid}'");
    //评论
    $_SGLOBAL['db']->query("DELETE FROM " . tname('comment') . " WHERE (uid='{$uid}' OR authorid='{$uid}' OR (id='{$uid}' AND idtype='uid'))");
    //访客
    $_SGLOBAL['db']->query("DELETE FROM " . tname('visitor') . " WHERE (uid='{$uid}' OR vuid='{$uid}')");
    //删除任务记录
    $_SGLOBAL['db']->query("DELETE FROM " . tname('usertask') . " WHERE uid='{$uid}'");
    //class
    $_SGLOBAL['db']->query("DELETE FROM " . tname('class') . " WHERE uid='{$uid}'");
    //friend
    //好友
    $_SGLOBAL['db']->query("DELETE FROM " . tname('friend') . " WHERE (uid='{$uid}' OR fuid='{$uid}')");
    //member
    $_SGLOBAL['db']->query("DELETE FROM " . tname('member') . " WHERE uid='{$uid}'");
    //删除脚印
    $_SGLOBAL['db']->query("DELETE FROM " . tname('clickuser') . " WHERE uid='{$uid}'");
    //删除黑名单
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blacklist') . " WHERE (uid='{$uid}' OR buid='{$uid}')");
    //删除邀请记录
    $_SGLOBAL['db']->query("DELETE FROM " . tname('invite') . " WHERE (uid='{$uid}' OR fuid='{$uid}')");
    //删除邮件队列
    $_SGLOBAL['db']->query("DELETE FROM " . tname('mailcron') . ", " . tname('mailqueue') . " USING " . tname('mailcron') . ", " . tname('mailqueue') . " WHERE " . tname('mailcron') . ".touid='{$uid}' AND " . tname('mailcron') . ".cid=" . tname('mailqueue') . ".cid");
    //漫游邀请
    $_SGLOBAL['db']->query("DELETE FROM " . tname('myinvite') . " WHERE (touid='{$uid}' OR fromuid='{$uid}')");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('userapp') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('userappfield') . " WHERE uid='{$uid}'");
    //mtag
    //thread
    $tids = array();
    $query = $_SGLOBAL['db']->query("SELECT tid, tagid FROM " . tname('thread') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $tids[$value['tagid']][] = $value['tid'];
    }
    foreach ($tids as $tagid => $v_tids) {
        deletethreads($tagid, $v_tids);
    }
    //post
    $pids = array();
    $query = $_SGLOBAL['db']->query("SELECT pid, tagid FROM " . tname('post') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pids[$value['tagid']][] = $value['pid'];
    }
    foreach ($pids as $tagid => $v_pids) {
        deleteposts($tagid, $v_pids);
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('thread') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('post') . " WHERE uid='{$uid}'");
    //session
    $_SGLOBAL['db']->query("DELETE FROM " . tname('session') . " WHERE uid='{$uid}'");
    //排行榜
    $_SGLOBAL['db']->query("DELETE FROM " . tname('show') . " WHERE uid='{$uid}'");
    //群组
    $mtagids = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('tagspace') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $mtagids[$value['tagid']] = $value['tagid'];
    }
    if ($mtagids) {
        $_SGLOBAL['db']->query("UPDATE " . tname('mtag') . " SET membernum=membernum-1 WHERE tagid IN (" . simplode($mtagids) . ")");
        $_SGLOBAL['db']->query("DELETE FROM " . tname('tagspace') . " WHERE uid='{$uid}'");
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('mtaginvite') . " WHERE (uid='{$uid}' OR fromuid='{$uid}')");
    //删除图片
    deletepicfiles($pics);
    //删除图片
    //删除举报
    $_SGLOBAL['db']->query("DELETE FROM " . tname('report') . " WHERE id='{$uid}' AND idtype='uid'");
    //变更记录
    if ($_SCONFIG['my_status']) {
        inserttable('userlog', array('uid' => $uid, 'action' => 'delete', 'dateline' => $_SGLOBAL['timestamp']), 0, true);
    }
    return $delspace;
}
コード例 #2
0
ファイル: admincp_poll.php プロジェクト: NaturalWill/UCQA
    //只能操作本人的
    $_GET['username'] = '';
}
if (submitcheck('deletesubmit')) {
    include_once S_ROOT . './source/function_delete.php';
    if (!empty($_POST['ids']) && deletepolls($_POST['ids'])) {
        cpmessage('do_success', $_POST['mpurl']);
    } else {
        cpmessage('the_correct_choice_to_delete_the_poll', $_POST['mpurl']);
    }
}
$mpurl = 'admincp.php?ac=poll';
$op = empty($_GET['op']) ? '' : trim($_GET['op']);
if ($op == 'delete') {
    include_once S_ROOT . './source/function_delete.php';
    deletepolls(array($_GET['pid']));
    cpmessage('do_success', $mpurl);
} else {
    //处理搜索
    if ($_GET['expiration']) {
        $val = $_GET['expiration'] == 1 ? 1 : 2;
        $_GET['expiration' . $val] = $_SGLOBAL['timestamp'];
    }
    $intkeys = array('uid', 'noreply', 'pid', 'sex');
    $strkeys = array('username');
    $randkeys = array(array('sstrtotime', 'dateline'), array('intval', 'voternum'), array('intval', 'replynum'), array('intval', 'percredit'), array('intval', 'expiration'), array('intval', 'hot'));
    $likekeys = array('subject');
    $results = getwheres($intkeys, $strkeys, $randkeys, $likekeys, '');
    $wherearr = $results['wherearr'];
    $mpurl .= '&' . implode('&', $results['urls']);
    $wheresql = empty($wherearr) ? '1' : implode(' AND ', $wherearr);
コード例 #3
0
ファイル: admincp_report.php プロジェクト: v998/discuzx-en
function deleteinfo($ids)
{
    global $_SGLOBAL;
    include_once S_ROOT . './source/function_delete.php';
    $deltype = array();
    $reportuser = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('report') . " WHERE rid IN (" . simplode($ids) . ")");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $value['user'] = unserialize($value['uids']);
        $reportuser[] = array_shift(array_flip($value['user']));
        $deltype[$value['idtype']][] = $value['id'];
    }
    $gid = getgroupid($_SGLOBAL['member']['experience'], $_SGLOBAL['member']['groupid']);
    //Perform the corresponding delete operations
    $i = 0;
    $_SGLOBAL['usergroup'][$gid]['managebatch'] = 1;
    foreach ($deltype as $key => $value) {
        switch ($key) {
            case 'blogid':
                $_SGLOBAL['usergroup'][$gid]['manageblog'] = 1;
                deleteblogs($value);
                break;
            case 'picid':
                $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1;
                deletepics($value);
                break;
            case 'albumid':
                $_SGLOBAL['usergroup'][$gid]['managealbum'] = 1;
                deletealbums($value);
                break;
            case 'tid':
                $_SGLOBAL['usergroup'][$gid]['managethread'] = 1;
                deletethreads(0, $value);
                break;
            case 'tagid':
                $_SGLOBAL['usergroup'][$gid]['managemtag'] = 1;
                deletemtag($value);
                break;
            case 'sid':
                $_SGLOBAL['usergroup'][$gid]['manageshare'] = 1;
                deleteshares($value);
                break;
            case 'uid':
                $_SGLOBAL['usergroup'][$gid]['managedelspace'] = 1;
                foreach ($value as $uid) {
                    deletespace($uid);
                }
                break;
            case 'eventid':
                $_SGLOBAL['usergroup'][$gid]['manageevent'] = 1;
                deleteevents($value);
                break;
            case 'pid':
                $_SGLOBAL['usergroup'][$gid]['managepoll'] = 1;
                deletepolls($value);
                break;
            case 'comment':
                $_SGLOBAL['usergroup'][$gid]['managecomment'] = 1;
                deletecomments($value);
                break;
            case 'post':
                $_SGLOBAL['usergroup'][$gid]['managethread'] = 1;
                deleteposts(0, $value);
                break;
        }
        //The first reporter award
        getreward('report', 1, $reportuser[$i], '', 0);
        $i++;
    }
}
コード例 #4
0
ファイル: cp_poll.php プロジェクト: v998/discuzx-en
        showmessage("option_exceeds_the_maximum_number_of", $_POST['refer']);
    }
    if (submitcheck('addopt')) {
        $newoption = getstr(trim($_POST['newoption']), 80, 1, 1, 1);
        if (strlen($newoption) < 1) {
            showmessage("added_option_should_not_be_empty");
        }
        $setarr = array('pid' => $pid, 'option' => $newoption);
        inserttable('polloption', $setarr);
        showmessage('do_success', $_POST['refer'], 0);
    }
} elseif ($op == 'delete') {
    //Delete poll
    if (submitcheck('deletesubmit')) {
        include_once S_ROOT . './source/function_delete.php';
        if (deletepolls(array($pid))) {
            showmessage('do_success', "space.php?uid={$poll['uid']}&do=poll&view=me");
        } else {
            showmessage('failed_to_delete_operation');
        }
    }
} elseif ($op == 'modify') {
    //Modify end time
    if (submitcheck('modifysubmit')) {
        $expiration = 0;
        if ($_POST['expiration']) {
            $expiration = sstrtotime(trim($_POST['expiration']) . ' 23:59:59');
            if ($expiration <= $_SGLOBAL['timestamp']) {
                showmessage('time_expired_error', $_POST['refer']);
            }
        }
コード例 #5
0
ファイル: function_delete.php プロジェクト: shiyake/php-ihome
function deletespace($uid, $force = 0)
{
    global $_SGLOBAL, $_SC, $_SCONFIG;
    $delspace = array();
    $allowmanage = checkperm('managedelspace');
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('space') . " WHERE uid='{$uid}'");
    if ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($force || $allowmanage && $value['uid'] != $_SGLOBAL['supe_uid']) {
            $delspace = $value;
            //Èç¹û²»ÊÇÇ¿ÖÆɾ³ýÔòÈëɾ³ý¼Ç¼±í
            if (!$force) {
                $setarr = array('uid' => $value['uid'], 'username' => saddslashes($value['username']), 'opuid' => $_SGLOBAL['supe_uid'], 'opusername' => $_SGLOBAL['supe_username'], 'flag' => '-1', 'dateline' => $_SGLOBAL['timestamp']);
                inserttable('spacelog', $setarr, 0, true);
            }
        }
    }
    if (empty($delspace)) {
        return array();
    }
    //ÂĸÇȨÏÞÉèÖÃ
    $_SGLOBAL['usergroup'][$_SGLOBAL['member']['groupid']]['managebatch'] = 1;
    //space
    $_SGLOBAL['db']->query("DELETE FROM " . tname('space') . " WHERE uid='{$uid}'");
    //spacefield
    $_SGLOBAL['db']->query("DELETE FROM " . tname('spacefield') . " WHERE uid='{$uid}'");
    //feed
    $_SGLOBAL['db']->query("DELETE FROM " . tname('feed') . " WHERE uid='{$uid}' OR (id='{$uid}' AND idtype='uid')");
    //¼Ç¼
    $doids = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('doing') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $doids[$value['doid']] = $value['doid'];
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('doing') . " WHERE uid='{$uid}'");
    //ɾ³ý¼Ç¼»Ø¸´
    $_SGLOBAL['db']->query("DELETE FROM " . tname('docomment') . " WHERE doid IN (" . simplode($doids) . ") OR uid='{$uid}'");
    //·ÖÏí
    $_SGLOBAL['db']->query("DELETE FROM " . tname('share') . " WHERE uid='{$uid}'");
    //Êý¾Ý
    $_SGLOBAL['db']->query("DELETE FROM " . tname('album') . " WHERE uid='{$uid}'");
    //ɾ³ý»ý·Ö¼Ç¼
    $_SGLOBAL['db']->query("DELETE FROM " . tname('creditlog') . " WHERE uid='{$uid}'");
    //ɾ³ý֪ͨ
    $_SGLOBAL['db']->query("DELETE FROM " . tname('notification') . " WHERE (uid='{$uid}' OR authorid='{$uid}')");
    //ɾ³ý´òÕкô
    $_SGLOBAL['db']->query("DELETE FROM " . tname('poke') . " WHERE (uid='{$uid}' OR fromuid='{$uid}')");
    //ɾ³ýËû²Ö½¨µÄͶƱ
    $pollid = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('poll') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pollid[$value['pid']] = $value['pid'];
    }
    deletepolls($pollid);
    //ɾ³ýËû²ÎÓëµÄͶƱ
    $pollid = array();
    $query = $_SGLOBAL['db']->query("SELECT pid FROM " . tname('polluser') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pollid[$value['pid']] = $value['pid'];
    }
    //¿Û³ýͶƱÊý
    if ($pollid) {
        $_SGLOBAL['db']->query("UPDATE " . tname('poll') . " SET voternum=voternum-1 WHERE pid IN (" . simplode($pollid) . ")");
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('polluser') . " WHERE uid='{$uid}'");
    //»î¶¯
    $ids = array();
    $query = $_SGLOBAL['db']->query('SELECT eventid FROM ' . tname('event') . " WHERE uid = '{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $ids[] = $value['eventid'];
    }
    deleteevents($ids);
    //ɾ³ýËû²Î¼ÓµÄ»î¶¯
    $ids = $ids1 = $ids2 = array();
    $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('userevent') . " WHERE uid = '{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if ($value['status'] == 1) {
            $ids1[] = $value['eventid'];
            //¹Ø×¢
        } elseif ($value['status'] > 1) {
            $ids2[] = $value['eventid'];
            //²Î¼Ó
        }
        $ids[] = $value['eventid'];
    }
    if ($ids1) {
        $_SGLOBAL['db']->query('UPDATE ' . tname('event') . ' SET follownum = follownum - 1 WHERE eventid IN (' . simplode($ids1) . ')');
    }
    if ($ids2) {
        $_SGLOBAL['db']->query('UPDATE ' . tname('event') . ' SET membernum = membernum - 1 WHERE eventid IN (' . simplode($ids2) . ')');
        // to to: ×îºÃ»¹Òª¼ì²é²¢¼õÈ¥ËûЯ´øµÄÈËÊý
    }
    if ($ids) {
        $_SGLOBAL['db']->query('DELETE FROM ' . tname('userevent') . ' WHERE eventid IN (' . simplode($ids) . ") AND uid = '{$uid}'");
    }
    //ɾ³ýÏà¹Ø»î¶¯ÑûÇë
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('eventinvite') . " WHERE uid = '{$uid}' OR touid = '{$uid}'");
    //ɾ³ýÉÏ´«µÄ»î¶¯Í¼Æ¬
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('eventpic') . " WHERE picid = '{$uid}'");
    //to do: ×îºÃͬʱ¸üлͼƬÊýºÍ»î¶¯»°ÌâÊý
    //µÀ¾ß
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('usermagic') . " WHERE uid = '{$uid}'");
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('magicinlog') . " WHERE uid = '{$uid}'");
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('magicuselog') . " WHERE uid = '{$uid}'");
    //pic
    //ɾ³ýͼƬ¸½¼þ
    $pics = array();
    $query = $_SGLOBAL['db']->query("SELECT filepath FROM " . tname('pic') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pics[] = $value;
    }
    //Êý¾Ý
    $_SGLOBAL['db']->query("DELETE FROM " . tname('pic') . " WHERE uid='{$uid}'");
    //blog
    $blogids = array();
    $query = $_SGLOBAL['db']->query("SELECT blogid FROM " . tname('blog') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $blogids[$value['blogid']] = $value['blogid'];
        //tag
        $tags = array();
        $subquery = $_SGLOBAL['db']->query("SELECT tagid, blogid FROM " . tname('tagblog') . " WHERE blogid='{$value['blogid']}'");
        while ($tag = $_SGLOBAL['db']->fetch_array($subquery)) {
            $tags[$tag['tagid']] = $tag['tagid'];
        }
        if ($tags) {
            $_SGLOBAL['db']->query("UPDATE " . tname('tag') . " SET blognum=blognum-1 WHERE tagid IN (" . simplode($tags) . ")");
            $_SGLOBAL['db']->query("DELETE FROM " . tname('tagblog') . " WHERE blogid='{$value['blogid']}'");
        }
    }
    //Êý¾Ýɾ³ý
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blog') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blogfield') . " WHERE uid='{$uid}'");
    //ÆÀÂÛ
    $_SGLOBAL['db']->query("DELETE FROM " . tname('comment') . " WHERE (uid='{$uid}' OR authorid='{$uid}' OR (id='{$uid}' AND idtype='uid'))");
    //·Ã¿Í
    $_SGLOBAL['db']->query("DELETE FROM " . tname('visitor') . " WHERE (uid='{$uid}' OR vuid='{$uid}')");
    //ɾ³ýÈÎÎñ¼Ç¼
    $_SGLOBAL['db']->query("DELETE FROM " . tname('usertask') . " WHERE uid='{$uid}'");
    //class
    $_SGLOBAL['db']->query("DELETE FROM " . tname('class') . " WHERE uid='{$uid}'");
    //friend
    //ºÃÓÑ
    $_SGLOBAL['db']->query("DELETE FROM " . tname('friend') . " WHERE (uid='{$uid}' OR fuid='{$uid}')");
    //member
    $_SGLOBAL['db']->query("DELETE FROM " . tname('member') . " WHERE uid='{$uid}'");
    //ɾ³ý½ÅÓ¡
    $_SGLOBAL['db']->query("DELETE FROM " . tname('clickuser') . " WHERE uid='{$uid}'");
    //ɾ³ýºÚÃûµ¥
    $_SGLOBAL['db']->query("DELETE FROM " . tname('blacklist') . " WHERE (uid='{$uid}' OR buid='{$uid}')");
    //ɾ³ýÑûÇë¼Ç¼
    $_SGLOBAL['db']->query("DELETE FROM " . tname('invite') . " WHERE (uid='{$uid}' OR fuid='{$uid}')");
    //ɾ³ýÓʼþ¶ÓÁÐ
    $_SGLOBAL['db']->query("DELETE FROM " . tname('mailcron') . ", " . tname('mailqueue') . " USING " . tname('mailcron') . ", " . tname('mailqueue') . " WHERE " . tname('mailcron') . ".touid='{$uid}' AND " . tname('mailcron') . ".cid=" . tname('mailqueue') . ".cid");
    //ÂþÓÎÑûÇë
    $_SGLOBAL['db']->query("DELETE FROM " . tname('myinvite') . " WHERE (touid='{$uid}' OR fromuid='{$uid}')");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('userapp') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('userappfield') . " WHERE uid='{$uid}'");
    //mtag
    //thread
    $tids = array();
    $query = $_SGLOBAL['db']->query("SELECT tid, tagid FROM " . tname('thread') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $tids[$value['tagid']][] = $value['tid'];
    }
    foreach ($tids as $tagid => $v_tids) {
        deletethreads($tagid, $v_tids);
    }
    //post
    $pids = array();
    $query = $_SGLOBAL['db']->query("SELECT pid, tagid FROM " . tname('post') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $pids[$value['tagid']][] = $value['pid'];
    }
    foreach ($pids as $tagid => $v_pids) {
        deleteposts($tagid, $v_pids);
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('thread') . " WHERE uid='{$uid}'");
    $_SGLOBAL['db']->query("DELETE FROM " . tname('post') . " WHERE uid='{$uid}'");
    //session
    $_SGLOBAL['db']->query("DELETE FROM " . tname('session') . " WHERE uid='{$uid}'");
    //ÅÅÐаñ
    $_SGLOBAL['db']->query("DELETE FROM " . tname('show') . " WHERE uid='{$uid}'");
    //Ⱥ×é
    $mtagids = array();
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('tagspace') . " WHERE uid='{$uid}'");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $mtagids[$value['tagid']] = $value['tagid'];
    }
    if ($mtagids) {
        $_SGLOBAL['db']->query("UPDATE " . tname('mtag') . " SET membernum=membernum-1 WHERE tagid IN (" . simplode($mtagids) . ")");
        $_SGLOBAL['db']->query("DELETE FROM " . tname('tagspace') . " WHERE uid='{$uid}'");
    }
    $_SGLOBAL['db']->query("DELETE FROM " . tname('mtaginvite') . " WHERE (uid='{$uid}' OR fromuid='{$uid}')");
    //ɾ³ýͼƬ
    deletepicfiles($pics);
    //ɾ³ýͼƬ
    //ɾ³ý¾Ù±¨
    $_SGLOBAL['db']->query("DELETE FROM " . tname('report') . " WHERE id='{$uid}' AND idtype='uid'");
    //±ä¸ü¼Ç¼
    if ($_SCONFIG['my_status']) {
        inserttable('userlog', array('uid' => $uid, 'action' => 'delete', 'dateline' => $_SGLOBAL['timestamp']), 0, true);
    }
    return $delspace;
}