<?php

/*
 * 등록 저장
 */
include_once './_common.php';
include_once './index.php';

if (!defined('_GNUBOARD_')) {
    exit;
}

if (!$_POST) {
    exit;
}

if (!$w) {

    $sql = "insert into ask_plugin_indexgroup set aig_status = '{$aig_status}', aig_area = '{$aig_area}', aig_column = '{$aig_column}', aig_sort = '{$aig_sort}'";
    sql_query($sql);
    $idx = sql_insert_id();
} elseif ($w == 'u' && $aig_idx) {

    $sql = "update ask_plugin_indexgroup set aig_status = '{$aig_status}', aig_area = '{$aig_area}', aig_column = '{$aig_column}', aig_sort = '{$aig_sort}' where aig_idx = '{$aig_idx}' limit 1";
    sql_query($sql);
    $idx = $aig_idx;
}
if($popup == 1){
    echo "<script>window.opener.location.reload();alert('수정되었습니다. 새로고침합니다.');window.close();</script>";
}else{
    goto_url('./indexgroup_add.php?w=u&idx=' . $idx);
}

