<?php
include_once('./_common.php');

if($is_admin !== "super") { exit; }

@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_tail     = '',
                co_html             = '1',
                co_tag_filter_use   = '',
                co_content          = '준비중입니다.',
                co_mobile_content   = '준비중입니다.',
                co_skin             = 'basic',
                co_mobile_skin      = 'basic' ";

/* 생성아이디, 페이지제목 순으로 적으면 됩니다. */
$co_array = array(
    array("greeting", "인사말"),
    array("location", "오시는길"),
    array("page1",    "내용1"),
    array("page2",    "내용2"),
    array("page3",    "내용3"),
    array("page4",    "내용4"),
    array("page5",    "내용5"),
    array("page6",    "내용6"),
    array("page7",    "내용7"),
    array("page8",    "내용8"),
    array("page9",    "내용9"),
    array("page0",    "내용0")
);

if ($_GET['go'] == "s")
{
    $count = count($co_array);

    for($i=0; $i<$count; $i++) {

        $co_id = $co_array[$i][0];
        $co_subject = $co_array[$i][1];

        //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',
                        co_subject          = '$co_subject',
                        $sql_common ";

        sql_query($sql);
        
        echo $co_id ."[".$co_subject."]생성 성공";
        echo "<br>";
    }

}

// goto_url("./contentlist.php");
?>

<a href="./contentlist.php">목록으로</a>

