//默认加入群组if($_SGLOBAL['supe_uid']){ $sql = "SELECT * FROM ".tname('mtag')." WHERE tagid=18"; //这个ID需要你修改成自己的默认群组的ID $query = $_SGLOBAL['db']->query($sql); $rs=($_SGLOBAL['db']->fetch_array($query)); if($rs) { //如果有该群组 $tagid = $rs['tagid']; //先查找当前用户是否已经加入了该群组 $sql = "SELECT * FROM `" .tname('tagspace'). "` WHERE tagid=$tagid AND uid=".$_SGLOBAL[supe_uid]; $query = $_SGLOBAL['db']->query($sql); $found_user_tagspace=($_SGLOBAL['db']->fetch_array($query)); if(!$found_user_tagspace) { //如果没有加入, $setarr=array('membernum'=>$rs['membernum']+1);//更新群组人数 updatetable('mtag',$setarr,array('tagid'=>$tagid)); unset($setarr); $setarr = array( 'tagid' => $tagid, 'uid' => $_SGLOBAL[supe_uid], 'username' => $_SGLOBAL[supe_username], 'grade' => 0 ); $tagspaceid=inserttable('tagspace',$setarr,1); //加入群组 } } }