<?php
/**
 * 
 * @copyright   2000-2007 LOCKON CO.,LTD. All Rights Reserved.
 * @version CVS: $Id: 1.0 2006-06-04 06:38:01Z matsumura $
 * @link        http://www.lockon.co.jp/
 *
 */
 
class LC_Page {
    
    function LC_Page() {
        $this->tpl_mainpage = MODULE_PATH . "blayn/blayn.tpl";
        $this->tpl_title = "ブレインIP登録";
    }
}
$objPage = new LC_Page();
$objView = new SC_AdminView();
$objQuery = new SC_Query();

echo "aaa";
echo"ccc";


if(isset($_POST['blayn_ip01'])) {
    lfDelete();
    lfRegist();
}
$objPage->arrIP = lfGetIP();
//sfprintr($objPage->arrIP);
$objView->assignobj($objPage);      //変数をテンプレートにアサインする
$objView->display($objPage->tpl_mainpage);      //テンプレートの出力

// ------------------------------------------------------------------------------------------------------

function lfRegist() {
    
    global $objQuery;
    
    $blayn_ip .= $_POST['blayn_ip01'];
    $blayn_ip .= "." . $_POST['blayn_ip02'];
    $blayn_ip .= "." . $_POST['blayn_ip03'];
    $blayn_ip .= "." . $_POST['blayn_ip04'];
    
    $sqlVal['blayn_ip'] = $blayn_ip;
    $objQuery->insert("dtb_blayn", $sqlVal);
}


function lfDelete() {
    
    global $objQuery;
    
    $objQuery->delete("dtb_blayn");
}


function lfGetIP() {
    
    global $objQuery;
    
    $arrSql = $objQuery->select("blayn_ip", "dtb_blayn");
    $arrRet = split("\.", $arrSql[0]['blayn_ip']);
    sfprintr($arrRet);
    return $arrRet;

}

?>
