/home/mjc1/public_html/adm/sms_admin/form_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
71
72
73
74
75
76
77
78
<?php
$sub_menu 
"900600";
include_once(
"./_common.php");

auth_check($auth[$sub_menu], "w");

$g5['title'] = "이모티콘 업데이트";

if (
$w == 'u'// 업데이트
{
    if (!
$fg_no$fg_no 0;

    if (!
$fo_receipt$fo_receipt 0; else $fo_receipt 1;

    if (!
strlen(trim($fo_name)))
        
alert('이름을 입력해주세요');

    if (!
strlen(trim($fo_content)))
        
alert('이모티콘을 입력해주세요');
/*
    $res = sql_fetch("select * from {$g5['sms5_form_table']} where fo_no<>'$fo_no' and fo_content='$fo_content'");
    if ($res)
        alert('같은 이모티콘이 존재합니다.');
*/
    
$res sql_fetch("select * from {$g5['sms5_form_table']} where fo_no='$fo_no'");
    if (!
$res)
        
alert('존재하지 않는 데이터 입니다.');

    if (
$fg_no != $res['fg_no']) {
        if (
$res['fg_no'])
            
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count - 1 where fg_no='{$res['fg_no']}'");

        
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count + 1 where fg_no='$fg_no'");
    }

    
$group sql_fetch("select * from {$g5['sms5_form_group_table']} where fg_no = '$fg_no'");

    
sql_query("update {$g5['sms5_form_table']} set fg_no='$fg_no', fg_member='{$group['fg_member']}', fo_name='$fo_name', fo_content='$fo_content', fo_datetime='".G5_TIME_YMDHIS."' where fo_no='$fo_no'");
}
else if (
$w == 'd'// 삭제
{
    if (!
is_numeric($fo_no))
        
alert('고유번호가 없습니다.');

    
$res sql_fetch("select * from {$g5['sms5_form_table']} where fo_no='$fo_no'");
    if (!
$res)
        
alert('존재하지 않는 데이터 입니다.');

    
sql_query("delete from {$g5['sms5_form_table']} where fo_no='$fo_no'");
    
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count - 1 where fg_no = '{$res['fg_no']}'");

    
$get_fg_no $fg_no;
}
else 
// 등록
{
    if (!
$fg_no$fg_no 0;

    if (!
strlen(trim($fo_name)))
        
alert('이름을 입력해주세요');

    if (!
strlen(trim($fo_content)))
        
alert('이모티콘을 입력해주세요');

    
$res sql_fetch("select * from {$g5['sms5_form_table']} where fo_content='$fo_content'");
    if (
$res)
        
alert('같은 이모티콘이 존재합니다.');

    
$group sql_fetch("select * from {$g5['sms5_form_group_table']} where fg_no = '$fg_no'");

    
sql_query("insert into {$g5['sms5_form_table']} set fg_no='$fg_no', fg_member='{$group['fg_member']}', fo_name='$fo_name', fo_content='$fo_content', fo_datetime='".G5_TIME_YMDHIS."'");
    
sql_query("update {$g5['sms5_form_group_table']} set fg_count = fg_count + 1 where fg_no = '$fg_no'");

    
$get_fg_no $fg_no;
}

$go_url './form_list.php?page='.$page.'&amp;fg_no='.$get_fg_no;
goto_url($go_url);
?>