source: branches/dev/data/downloads/module/blayn/blayn.php.txt @ 14582

Revision 14582, 3.7 KB checked in by matsumura, 15 years ago (diff)
Line 
1<?php
2/**
3 *
4 * @copyright   2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 * @version CVS: $Id: 1.0 2006-06-04 06:38:01Z matsumura $
6 * @link        http://www.lockon.co.jp/
7 *
8 */
9 
10class LC_Page {
11   
12    function LC_Page() {
13        $this->tpl_mainpage = MODULE_PATH . "blayn/blayn.tpl";
14        $this->tpl_title = "¥Ö¥ì¥¤¥óIPÅÐÏ¿";
15        $this->tpl_subtitle = "¥Ö¥ì¥¤¥óIPÀßÄê¥â¥¸¥å¡¼¥ë";
16    }
17}
18$objPage = new LC_Page();
19$objView = new SC_AdminView();
20$objQuery = new SC_Query();
21$objFormParam = new SC_FormParam;
22
23// ½é´ü²½
24lfIntiParam();
25
26$objFormParam->setParam($_POST);
27$objPage->arrIP = $objFormParam->getHashArray();
28
29$url = SITE_URL . "admin/system/module.php";
30$tpl_onload  = "onload = \"opener_reload('" .$url. "');window.close();\"";
31
32switch ($_POST['mode']) {
33   
34    case 'regist':
35        // ¥¨¥é¡¼¥Á¥§¥Ã¥¯
36        $objPage->arrErr = lfErrorcheck();
37        if(count($objPage->arrErr) <= 0) {
38            // °ìö¥Æ¡¼¥Ö¥ë¤ÎÃͤò¤¹¤Ù¤Æ¾Ãµî¡ÊlfGetIP¤Çwhere»ØÄê¤Î¼ê´Ö¤ò¾Ê¤¯¤¿¤á¡Ë
39            lfDelete();
40            // ÅÐÏ¿
41            lfRegist();
42            $objPage->tpl_onload = $tpl_onload;           
43        }
44    break;
45   
46   
47    default:
48        // ½é´üɽ¼¨
49        $objPage->arrIP = lfGetIP();
50}
51
52// ½é´üɽ¼¨°Ê³°¤Ï'regist'¤òÄ̤餻¤ë
53$objPage->mode = 'regist';
54
55$objView->assignobj($objPage);      //ÊÑ¿ô¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¥¢¥µ¥¤¥ó¤¹¤ë
56$objView->display($objPage->tpl_mainpage);      //¥Æ¥ó¥×¥ì¡¼¥È¤Î½ÐÎÏ
57
58// ------------------------------------------------------------------------------------------------------
59
60/**
61 * Ãͤνé´ü²½
62 *
63 * @return void ¤Ê¤·
64 */
65function lfIntiParam() {
66   
67    global $objFormParam;
68   
69        $objFormParam->addParam("IP¥¢¥É¥ì¥¹1", "blayn_ip01", INT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
70        $objFormParam->addParam("IP¥¢¥É¥ì¥¹2", "blayn_ip02", INT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
71        $objFormParam->addParam("IP¥¢¥É¥ì¥¹3", "blayn_ip03", INT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
72        $objFormParam->addParam("IP¥¢¥É¥ì¥¹4", "blayn_ip04", INT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
73}
74
75
76/**
77 * ¥¨¥é¡¼¥Á¥§¥Ã¥¯
78 *
79 * @return array $arr->arrErr
80 */
81function lfErrorcheck() {
82   
83    global $objFormParam;
84   
85    $arrList = $objFormParam->getHashArray();
86    $objErr = new SC_CheckError($arrList);
87    $arrErr->arrErr = $objFormParam->checkError();
88
89    return $arrErr->arrErr;
90   
91}
92
93
94/**
95 * IP¥¢¥É¥ì¥¹ÅÐÏ¿
96 *
97 * @return void ¤Ê¤·
98 */
99function lfRegist() {
100   
101    global $objQuery;
102    global $objFormParam;
103   
104    $arrPost = $objFormParam->getHashArray();
105    // IP¥¢¥É¥ì¥¹¤Î·Á¤ËÀ°·Á
106    $blayn_ip .= $arrPost['blayn_ip01'];
107    $blayn_ip .= "." . $arrPost['blayn_ip02'];
108    $blayn_ip .= "." . $arrPost['blayn_ip03'];
109    $blayn_ip .= "." . $arrPost['blayn_ip04'];
110   
111    $sqlVal['blayn_ip'] = $blayn_ip;
112    $objQuery->insert("dtb_blayn", $sqlVal);
113}
114
115
116/**
117 * ¥Æ¡¼¥Ö¥ë¤ÎÃÍÁ´¾Ãµî
118 *
119 * @return void ¤Ê¤·
120 */
121function lfDelete() {
122   
123    global $objQuery;
124   
125    $objQuery->delete("dtb_blayn");
126}
127
128
129/**
130 * IP¥¢¥É¥ì¥¹¼èÆÀ
131 *
132 * @return array $arrRet
133 */
134function lfGetIP() {
135   
136    global $objQuery;
137   
138    $arrSql = $objQuery->select("blayn_ip", "dtb_blayn");
139    // ¥Õ¥©¡¼¥à¤ËÆþ¤ì¤ë·Á¤ËÀ°·Á
140    $arrRet = split("\.", $arrSql[0]['blayn_ip']);
141   
142    // Smarty¤Ëɽ¼¨¤µ¤»¤ë¤¿¤á¤ËÀ°·Á
143    $arrRet[blayn_ip01] = $arrRet[0];
144    $arrRet[blayn_ip02] = $arrRet[1];
145    $arrRet[blayn_ip03] = $arrRet[2];
146    $arrRet[blayn_ip04] = $arrRet[3];
147       
148    return $arrRet;
149}
150
151?>
Note: See TracBrowser for help on using the repository browser.