/home/mjc1/public_html/adm/contentformupdate.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
79
80
81
<?php
$sub_menu 
'300600';
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."/content"G5_DIR_PERMISSION);
@
chmod(G5_DATA_PATH."/content"G5_DIR_PERMISSION);

if (
$co_himg_del)  @unlink(G5_DATA_PATH."/content/{$co_id}_h");
if (
$co_timg_del)  @unlink(G5_DATA_PATH."/content/{$co_id}_t");

$sql_common " co_include_head     = '$co_include_head',
                co_include_tail     = '
$co_include_tail',
                co_html             = '
$co_html',
                co_tag_filter_use   = '
$co_tag_filter_use',
                co_subject          = '
$co_subject',
                co_content          = '
$co_content',
                co_mobile_content   = '
$co_mobile_content',
                co_skin             = '
$co_skin',
                co_mobile_skin      = '
$co_mobile_skin' ";

if (
$w == "")
{
    
//if(eregi("[^a-z0-9_]", $co_id)) alert("ID 는 영문자, 숫자, _ 만 가능합니다.");
    
if(preg_match("/[^a-z0-9_]/i"$co_id)) alert("ID 는 영문자, 숫자, _ 만 가능합니다.");

    
$sql " select co_id from {$g5['content_table']} where co_id = '$co_id' ";
    
$row sql_fetch($sql);
    if (
$row['co_id'])
        
alert("이미 같은 ID로 등록된 내용이 있습니다.");

    
$sql " insert {$g5['content_table']}
                set co_id = '
$co_id',
                    
$sql_common ";
    
sql_query($sql);
}
else if (
$w == "u")
{
    
$sql " update {$g5['content_table']}
                set 
$sql_common
              where co_id = '
$co_id' ";
    
sql_query($sql);
}
else if (
$w == "d")
{
    @
unlink(G5_DATA_PATH."/content/{$co_id}_h");
    @
unlink(G5_DATA_PATH."/content/{$co_id}_t");

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

if (
$w == "" || $w == "u")
{
    if (
$_FILES['co_himg']['name'])
    {
        
$dest_path G5_DATA_PATH."/content/".$co_id."_h";
        @
move_uploaded_file($_FILES['co_himg']['tmp_name'], $dest_path);
        @
chmod($dest_pathG5_FILE_PERMISSION);
    }
    if (
$_FILES['co_timg']['name'])
    {
        
$dest_path G5_DATA_PATH."/content/".$co_id."_t";
        @
move_uploaded_file($_FILES['co_timg']['tmp_name'], $dest_path);
        @
chmod($dest_pathG5_FILE_PERMISSION);
    }

    
goto_url("./contentform.php?w=u&amp;co_id=$co_id");
}
else
{
    
goto_url("./contentlist.php");
}
?>