/home/mjc1/public_html/adm/faqmasterformupdate.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
<?php
$sub_menu 
'300700';
include_once(
'./_common.php');

if (
$w == "u" || $w == "d")
    
check_demo();

if (
$W == 'd')
    
auth_check($auth[$sub_menu], "d");
else
    
auth_check($auth[$sub_menu], "w");

@
mkdir(G5_DATA_PATH."/faq"G5_DIR_PERMISSION);
@
chmod(G5_DATA_PATH."/faq"G5_DIR_PERMISSION);

if (
$fm_himg_del)  @unlink(G5_DATA_PATH."/faq/{$fm_id}_h");
if (
$fm_timg_del)  @unlink(G5_DATA_PATH."/faq/{$fm_id}_t");

$sql_common " set fm_subject = '$fm_subject',
                    fm_head_html = '
$fm_head_html',
                    fm_tail_html = '
$fm_tail_html',
                    fm_mobile_head_html = '
$fm_mobile_head_html',
                    fm_mobile_tail_html = '
$fm_mobile_tail_html',
                    fm_order = '
$fm_order' ";

if (
$w == "")
{
    
$sql " alter table {$g5['faq_master_table']} auto_increment=1 ";
    
sql_query($sql);

    
$sql " insert {$g5['faq_master_table']} $sql_common ";
    
sql_query($sql);

    
$fm_id mysql_insert_id();
}
else if (
$w == "u")
{
    
$sql " update {$g5['faq_master_table']} $sql_common where fm_id = '$fm_id' ";
    
sql_query($sql);
}
else if (
$w == "d")
{
    @
unlink(G5_DATA_PATH."/faq/{$fm_id}_h");
    @
unlink(G5_DATA_PATH."/faq/{$fm_id}_t");

    
// FAQ삭제
    
$sql " delete from {$g5['faq_master_table']} where fm_id = '$fm_id' ";
    
sql_query($sql);

    
// FAQ상세삭제
    
$sql " delete from {$g5['faq_table']} where fm_id = '$fm_id' ";
    
sql_query($sql);
}

if (
$w == "" || $w == "u")
{
    if (
$_FILES['fm_himg']['name']){
        
$dest_path G5_DATA_PATH."/faq/".$fm_id."_h";
        @
move_uploaded_file($_FILES['fm_himg']['tmp_name'], $dest_path);
        @
chmod($dest_pathG5_FILE_PERMISSION);
    }
    if (
$_FILES['fm_timg']['name']){
        
$dest_path G5_DATA_PATH."/faq/".$fm_id."_t";
        @
move_uploaded_file($_FILES['fm_timg']['tmp_name'], $dest_path);
        @
chmod($dest_pathG5_FILE_PERMISSION);
    }

    
goto_url("./faqmasterform.php?w=u&amp;fm_id=$fm_id");
}
else
    
goto_url("./faqmasterlist.php");
?>