/home/mjc1/public_html/adm/boardgroupmember_update.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
$sub_menu 
"300200";
include_once(
'./_common.php');

sql_query(" ALTER TABLE {$g5['group_member_table']} CHANGE `gm_id` `gm_id` INT( 11 ) DEFAULT '0' NOT NULL AUTO_INCREMENT "false);

if (
$w == '')
{
    
auth_check($auth[$sub_menu], 'w');

    
$mb get_member($mb_id);
    if (!
$mb['mb_id']) {
        
alert('존재하지 않는 회원입니다.');
    }

    
$gr get_group($gr_id);
    if (!
$gr['gr_id']) {
        
alert('존재하지 않는 그룹입니다.');
    }

    
$sql " select count(*) as cnt
                from 
{$g5['group_member_table']}
                where gr_id = '
{$gr_id}'
                and mb_id = '
{$mb_id}' ";
    
$row sql_fetch($sql);
    if (
$row['cnt']) {
        
alert('이미 등록되어 있는 자료입니다.');
    }
    else
    {
        
check_token();

        
$sql " insert into {$g5['group_member_table']}
                    set gr_id = '
{$_POST['gr_id']}',
                         mb_id = '
{$_POST['mb_id']}',
                         gm_datetime = '"
.G5_TIME_YMDHIS."' ";
        
sql_query($sql);
    }
}
else if (
$w == 'd' || $w == 'ld')
{
    
auth_check($auth[$sub_menu], 'd');

    
$count count($_POST['chk']);
    if(!
$count)
        
alert('삭제할 목록을 하나이상 선택해 주세요.');

    
check_token();

    for(
$i=0$i<$count$i++) {
        
$gm_id $_POST['chk'][$i];
        
$sql " select * from {$g5['group_member_table']} where gm_id = '$gm_id' ";
        
$gm sql_fetch($sql);
        if (!
$gm['gm_id']) {
            if(
$count == 1)
                
alert('존재하지 않는 자료입니다.');
            else
                continue;
        }

        
$sql " delete from {$g5['group_member_table']} where gm_id = '$gm_id' ";
        
sql_query($sql);
    }
}

if (
$w == 'ld')
    
goto_url('./boardgroupmember_list.php?gr_id='.$gr_id);
else
    
goto_url('./boardgroupmember_form.php?mb_id='.$mb_id);
?>