source: branches/rel/html/mobile/mypage/change.php @ 12157

Revision 12157, 18.2 KB checked in by uehara, 16 years ago (diff)
Line 
1<?php
2/**
3 *
4 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 *
6 * http://www.lockon.co.jp/
7 *
8 *
9 * ¾ðÊóÊѹ¹
10 */
11
12require_once("../require.php");
13
14class LC_Page {
15    function LC_Page() {
16        $this->tpl_mainpage = 'mypage/change.tpl';      // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È
17        $this->tpl_title .= 'ÅÐÏ¿Êѹ¹(1/3)';            //¡¡¥Ú¡¼¥¸¥¿¥¤¥È¥ë
18    }
19}
20
21//---- ¥Ú¡¼¥¸½é´üÀßÄê
22$CONF = sf_getBasisData();                  // ŹÊÞ´ðËܾðÊó
23$objConn = new SC_DbConn();
24$objPage = new LC_Page();
25$objView = new SC_MobileView();
26$objDate = new SC_Date(START_BIRTH_YEAR, date("Y",strtotime("now")));
27$objQuery = new SC_Query();
28$objCustomer = new SC_Customer();
29$objPage->arrPref = $arrPref;
30$objPage->arrJob = $arrJob;
31$objPage->arrReminder = $arrReminder;
32$objPage->arrYear = $objDate->getYear('', 1950);    //¡¡ÆüÉÕ¥×¥ë¥À¥¦¥óÀßÄê
33$objPage->arrMonth = $objDate->getMonth();
34$objPage->arrDay = $objDate->getDay();
35
36// ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ
37$objPage = sfGetPageLayout($objPage, false, DEF_LAYOUT);
38
39//---- ÅÐÏ¿ÍÑ¥«¥é¥àÇÛÎó
40$arrRegistColumn = array(
41                             array(  "column" => "name01", "convert" => "aKV" ),
42                             array(  "column" => "name02", "convert" => "aKV" ),
43                             array(  "column" => "kana01", "convert" => "CKV" ),
44                             array(  "column" => "kana02", "convert" => "CKV" ),
45                             array(  "column" => "zip01", "convert" => "n" ),
46                             array(  "column" => "zip02", "convert" => "n" ),
47                             array(  "column" => "pref", "convert" => "n" ),
48                             array(  "column" => "addr01", "convert" => "aKV" ),
49                             array(  "column" => "addr02", "convert" => "aKV" ),
50                             array(  "column" => "email", "convert" => "a" ),
51                             array(  "column" => "email_mobile", "convert" => "a" ),
52                             array(  "column" => "tel01", "convert" => "n" ),
53                             array(  "column" => "tel02", "convert" => "n" ),
54                             array(  "column" => "tel03", "convert" => "n" ),
55                             array(  "column" => "fax01", "convert" => "n" ),
56                             array(  "column" => "fax02", "convert" => "n" ),
57                             array(  "column" => "fax03", "convert" => "n" ),
58                             array(  "column" => "sex", "convert" => "n" ),
59                             array(  "column" => "job", "convert" => "n" ),
60                             array(  "column" => "birth", "convert" => "n" ),
61                             array(  "column" => "reminder", "convert" => "n" ),
62                             array(  "column" => "reminder_answer", "convert" => "aKV"),
63                             array(  "column" => "password", "convert" => "a" ),
64                             array(  "column" => "mailmaga_flg", "convert" => "n" )         
65                         );
66
67//---- ÅÐÏ¿½ü³°ÍÑ¥«¥é¥àÇÛÎó
68$arrRejectRegistColumn = array("year", "month", "day", "email02", "email_mobile02", "password02");
69
70$objPage->arrForm = lfGetCustomerData();
71$objPage->arrForm['password'] = DEFAULT_PASSWORD;
72
73if ($_SERVER["REQUEST_METHOD"] == "POST") {
74
75    //-- POST¥Ç¡¼¥¿¤Î°ú¤­·Ñ¤®
76    $objPage->arrForm = array_merge($objPage->arrForm, $_POST);
77
78    if($objPage->arrForm['year'] == '----') {
79        $objPage->arrForm['year'] = '';
80    }
81   
82    $objPage->arrForm['email'] = strtolower($objPage->arrForm['email']);        // email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
83   
84    //-- ÆþÎϥǡ¼¥¿¤ÎÊÑ´¹
85    $objPage->arrForm = lfConvertParam($objPage->arrForm, $arrRegistColumn);
86
87    // Ìá¤ë¥Ü¥¿¥óÍѽèÍý
88    if (!empty($_POST["return"])) {
89        switch ($_POST["mode"]) {
90        case "complete":
91            $_POST["mode"] = "set3";
92            break;
93        case "confirm":
94            $_POST["mode"] = "set2";
95            break;
96        default:
97            $_POST["mode"] = "set1";
98            break;
99        }
100    }
101
102    //--¡¡ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
103    if ($_POST["mode"] == "set1") {
104        $objPage->arrErr = lfErrorCheck1($objPage->arrForm);
105        $objPage->tpl_mainpage = 'mypage/change.tpl';
106        $objPage->tpl_title = 'ÅÐÏ¿Êѹ¹(1/3)';
107    } elseif ($_POST["mode"] == "set2") {
108        $objPage->arrErr = lfErrorCheck2($objPage->arrForm);
109        $objPage->tpl_mainpage = 'mypage/set1.tpl';
110        $objPage->tpl_title = 'ÅÐÏ¿Êѹ¹(2/3)';
111    } else {
112        $objPage->arrErr = lfErrorCheck3($objPage->arrForm);
113        $objPage->tpl_mainpage = 'mypage/set2.tpl';
114        $objPage->tpl_title = 'ÅÐÏ¿Êѹ¹(3/3)';
115    }
116
117    if ($objPage->arrErr || !empty($_POST["return"])) {     // ÆþÎÏ¥¨¥é¡¼¤Î¥Á¥§¥Ã¥¯
118        foreach($objPage->arrForm as $key => $val) {
119            $objPage->$key = $val;
120        }
121
122        //-- ¥Ç¡¼¥¿¤ÎÀßÄê
123        if ($_POST["mode"] == "set1") {
124            $checkVal = array("email", "password", "reminder", "reminder_answer", "name01", "name02", "kana01", "kana02");
125        } elseif ($_POST["mode"] == "set2") {
126            $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
127        } else {
128            $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mail_flag");
129        }
130
131        foreach($objPage->arrForm as $key => $val) {
132            if ($key != "return" && $key != "mode" && $key != "confirm" && $key != session_name() && !in_array($key, $checkVal)) {
133                $objPage->list_data[ $key ] = $val;
134            }
135        }
136
137    } else {
138
139        //--¡¡¥Æ¥ó¥×¥ì¡¼¥ÈÀßÄê
140        if ($_POST["mode"] == "set1") {
141            $objPage->tpl_mainpage = 'mypage/set1.tpl';
142            $objPage->tpl_title = 'ÅÐÏ¿Êѹ¹(2/3)';
143        } elseif ($_POST["mode"] == "set2") {
144            $objPage->tpl_mainpage = 'mypage/set2.tpl';
145            $objPage->tpl_title = 'ÅÐÏ¿Êѹ¹(3/3)';
146        } elseif ($_POST["mode"] == "confirm") {
147            //¥Ñ¥¹¥ï¡¼¥Éɽ¼¨
148            $passlen = strlen($objPage->arrForm['password']);
149            $objPage->passlen = lfPassLen($passlen);
150
151            // ¥á¡¼¥ë¼õ¤±¼è¤ê
152            if (strtolower($_POST['mailmaga_flg']) == "on") {
153                $_POST['mailmaga_flg']  = "2";
154            } else {
155                $_POST['mailmaga_flg']  = "3";
156            }
157
158            $objPage->tpl_mainpage = 'mypage/change_confirm.tpl';
159            $objPage->tpl_title = 'ÅÐÏ¿Êѹ¹(³Îǧ¥Ú¡¼¥¸)';
160
161        }
162
163        //-- ¥Ç¡¼¥¿ÀßÄê
164        unset($objPage->list_data);
165        if ($_POST["mode"] == "set1") {
166            $checkVal = array("sex", "year", "month", "day", "zip01", "zip02");
167        } elseif ($_POST["mode"] == "set2") {
168            $checkVal = array("pref", "addr01", "addr02", "tel01", "tel02", "tel03", "mail_flag");
169        } else {
170            $checkVal = array();
171        }
172
173        foreach($_POST as $key => $val) {
174            if ($key != "return" && $key != "mode" && $key != "confirm" && $key != session_name() && !in_array($key, $checkVal)) {
175                $objPage->list_data[ $key ] = $val;
176            }
177        }
178
179
180        //--¡¡²¾ÅÐÏ¿¤È´°Î»²èÌÌ
181        if ($_POST["mode"] == "complete") {
182
183            //-- ÆþÎϥǡ¼¥¿¤ÎÊÑ´¹
184            $arrForm = lfConvertParam($_POST, $arrRegistColumn);
185            $arrForm['email'] = strtolower($arrForm['email']);      // email¤Ï¤¹¤Ù¤Æ¾®Ê¸»ú¤Ç½èÍý
186   
187            //¥¨¥é¡¼¥Á¥§¥Ã¥¯
188            $objPage->arrErr = lfErrorCheck($objPage->arrForm);
189            $email_flag = true;
190
191            if($objPage->arrForm['email'] != $objCustomer->getValue('email_mobile')) {
192                //¥á¡¼¥ë¥¢¥É¥ì¥¹¤Î½ÅÊ£¥Á¥§¥Ã¥¯
193                $email_cnt = $objQuery->count("dtb_customer","del_flg=0 AND (email=? OR email_mobile=?)", array($objPage->arrForm['email'], $objPage->arrForm['email']));
194                if ($email_cnt > 0){
195                    $email_flag = false;
196                }
197            }
198
199            //¥¨¥é¡¼¤Ê¤·¤Ç¤«¤Ä¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬½ÅÊ£¤·¤Æ¤¤¤Ê¤¤¾ì¹ç
200            if($objPage->arrErr == "" && $email_flag) {
201                $arrForm['customer_id'] = $objCustomer->getValue('customer_id');
202                //-- ÊÔ½¸ÅÐÏ¿
203                sfEditCustomerData($arrForm, $arrRegistColumn);
204                //¥»¥Ã¥·¥ç¥ó¾ðÊó¤òºÇ¿·¤Î¾õÂ֤˹¹¿·¤¹¤ë
205                $objCustomer->updateSession();
206                //´°Î»¥Ú¡¼¥¸¤Ø
207                header("Location: " . gfAddSessionId("change_complete.php"));
208                exit;
209            } else {
210                sfDispSiteError(CUSTOMER_ERROR, "", false, "", true);
211            }
212
213        }
214    }
215}
216
217$arrPrivateVariables = array('secret_key', 'first_buy_date', 'last_buy_date', 'buy_times', 'buy_total', 'point', 'note', 'status', 'create_date', 'update_date', 'del_flg', 'cell01', 'cell02', 'cell03', 'mobile_phone_id');
218foreach ($arrPrivateVariables as $key) {
219    unset($objPage->list_data[$key]);
220}
221
222//----¡¡¥Ú¡¼¥¸É½¼¨
223$objView->assignobj($objPage);
224$objView->display(SITE_FRAME);
225
226//----------------------------------------------------------------------------------------------------------------------
227
228//---- function·²
229function lfRegistData ($array, $arrRegistColumn, $arrRejectRegistColumn) {
230    global $objConn;
231
232    // ²¾ÅÐÏ¿
233    foreach ($arrRegistColumn as $data) {
234        if (strlen($array[ $data["column"] ]) > 0 && ! in_array($data["column"], $arrRejectRegistColumn)) {
235            $arrRegist[ $data["column"] ] = $array[ $data["column"] ];
236        }
237    }
238       
239    // ÃÂÀ¸Æü¤¬ÆþÎϤµ¤ì¤Æ¤¤¤ë¾ì¹ç
240    if (strlen($array["year"]) > 0 ) {
241        $arrRegist["birth"] = $array["year"] ."/". $array["month"] ."/". $array["day"] ." 00:00:00";
242    }
243   
244    // ¥Ñ¥¹¥ï¡¼¥É¤Î°Å¹æ²½
245    $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
246   
247    $count = 1;
248    while ($count != 0) {
249        $uniqid = sfGetUniqRandomId("t");
250        $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
251    }
252   
253    $arrRegist["secret_key"] = $uniqid;     // ²¾ÅÐÏ¿IDȯ¹Ô
254    $arrRegist["create_date"] = "now()";    // ºîÀ®Æü
255    $arrRegist["update_date"] = "now()";    // ¹¹¿·Æü
256    $arrRegist["first_buy_date"] = "";      // ºÇ½é¤Î¹ØÆþÆü
257   
258    // ·ÈÂӥ᡼¥ë¥¢¥É¥ì¥¹
259    $arrRegist['email_mobile'] = $arrRegist['email'];
260
261    //-- ²¾ÅÐÏ¿¼Â¹Ô
262    $objConn->query("BEGIN");
263
264    $objQuery = new SC_Query();
265    $objQuery->insert("dtb_customer", $arrRegist);
266    $objConn->query("COMMIT");
267
268    return $uniqid;
269}
270
271//----¡¡¼èÆÀʸ»úÎó¤ÎÊÑ´¹
272function lfConvertParam($array, $arrRegistColumn) {
273    /*
274     *  ʸ»úÎó¤ÎÊÑ´¹
275     *  K :  ¡ÖȾ³Ñ(ŽÊŽÝŽ¶Ž¸)ÊÒ²¾Ì¾¡×¤ò¡ÖÁ´³ÑÊÒ²¾Ì¾¡×¤ËÊÑ´¹
276     *  C :  ¡ÖÁ´³Ñ¤Ò¤é²¾Ì¾¡×¤ò¡ÖÁ´³Ñ¤«¤¿²¾Ì¾¡×¤ËÊÑ´¹
277     *  V :  ÂùÅÀÉÕ¤­¤Îʸ»ú¤ò°ìʸ»ú¤ËÊÑ´¹¡£"K","H"¤È¶¦¤Ë»ÈÍѤ·¤Þ¤¹ 
278     *  n :  ¡ÖÁ´³Ñ¡×¿ô»ú¤ò¡ÖȾ³Ñ(ŽÊŽÝŽ¶Ž¸)¡×¤ËÊÑ´¹
279     *  a :  Á´³Ñ±Ñ¿ô»ú¤òȾ³Ñ±Ñ¿ô»ú¤ËÊÑ´¹¤¹¤ë
280     */
281    // ¥«¥é¥à̾¤È¥³¥ó¥Ð¡¼¥È¾ðÊó
282    foreach ($arrRegistColumn as $data) {
283        $arrConvList[ $data["column"] ] = $data["convert"];
284    }
285    // ʸ»úÊÑ´¹
286    foreach ($arrConvList as $key => $val) {
287        // POST¤µ¤ì¤Æ¤­¤¿ÃͤΤßÊÑ´¹¤¹¤ë¡£
288        if(strlen(($array[$key])) > 0) {
289            $array[$key] = mb_convert_kana($array[$key] ,$val);
290        }
291    }
292    return $array;
293}
294
295
296//¥¨¥é¡¼¥Á¥§¥Ã¥¯
297
298function lfErrorCheck($array) {
299    $objErr = new SC_CheckError($array);
300   
301    $objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
302    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê̾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
303    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê¥«¥Ê/À«¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
304    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê¥«¥Ê/̾¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
305    $objErr->doFunc(array("͹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
306    $objErr->doFunc(array("͹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
307    $objErr->doFunc(array("͹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
308    $objErr->doFunc(array("ÅÔÆ»Éܸ©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
309    $objErr->doFunc(array("»Ô¶èĮ¼", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
310    $objErr->doFunc(array("ÈÖÃÏ", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
311    $objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("EXIST_CHECK", "EMAIL_CHECK", "NO_SPTAB" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
312    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK"));
313    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK"));
314    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK"));
315    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03", TEL_LEN) ,array("TEL_CHECK"));
316    $objErr->doFunc(array("FAXÈÖ¹æ", "fax01", "fax02", "fax03", TEL_LEN) ,array("TEL_CHECK"));
317    $objErr->doFunc(array("À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
318    $objErr->doFunc(array("¤´¿¦¶È", "job") ,array("NUM_CHECK"));
319    $objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
320    $objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "ALNUM_CHECK", "NUM_RANGE_CHECK"));
321    $objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É³ÎǧÍѤμÁÌä", "reminder") ,array("SELECT_CHECK", "NUM_CHECK"));
322    $objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É³ÎǧÍѤμÁÌä¤ÎÅú¤¨", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
323    return $objErr->arrErr;
324   
325}
326
327//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
328function lfErrorCheck1($array) {
329
330    global $objConn;
331    global $objCustomer;
332    $objErr = new SC_CheckError($array);
333   
334    $objErr->doFunc(array("¤ªÌ¾Á°¡ÊÀ«¡Ë", 'name01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
335    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê̾¡Ë", 'name02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
336    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê¥«¥Ê/À«¡Ë", 'kana01', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
337    $objErr->doFunc(array("¤ªÌ¾Á°¡Ê¥«¥Ê/̾¡Ë", 'kana02', STEXT_LEN), array("EXIST_CHECK", "NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
338    $objErr->doFunc(array('¥á¡¼¥ë¥¢¥É¥ì¥¹', "email", MTEXT_LEN) ,array("NO_SPTAB", "EXIST_CHECK", "EMAIL_CHECK", "SPTAB_CHECK" ,"EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK", "MOBILE_EMAIL_CHECK"));
339
340    //¸½²ñ°÷¤ÎȽÄê ¢ª¡¡¸½²ñ°÷¤â¤·¤¯¤Ï²¾ÅÐÏ¿Ãæ¤Ï¡¢¥á¥¢¥É°ì°Õ¤¬Á°Äó¤Ë¤Ê¤Ã¤Æ¤ë¤Î¤ÇƱ¤¸¥á¥¢¥É¤ÇÅÐÏ¿ÉÔ²Ä
341    $array["customer_id"] = $objCustomer->getValue('customer_id');
342    if (strlen($array["email"]) > 0) {
343        $objQuery = new SC_Query();
344        $arrRet = $objQuery->select("email, update_date, del_flg", "dtb_customer","customer_id <> ? and (email ILIKE ? OR email_mobile ILIKE ?) ORDER BY del_flg", array($array["customer_id"], $array["email"], $array["email"]));
345
346        if(count($arrRet) > 0) {
347            if($arrRet[0]['del_flg'] != '1') {
348                // ²ñ°÷¤Ç¤¢¤ë¾ì¹ç
349                $objErr->arrErr["email"] .= "¢¨ ¤¹¤Ç¤Ë²ñ°÷ÅÐÏ¿¤Ç»ÈÍѤµ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£<br />";
350            } else {
351                // Âà²ñ¤·¤¿²ñ°÷¤Ç¤¢¤ë¾ì¹ç
352                $leave_time = sfDBDatetoTime($arrRet[0]['update_date']);
353                $now_time = time();
354                $pass_time = $now_time - $leave_time;
355                // Âà²ñ¤«¤é²¿»þ´Ö-·Ð²á¤·¤Æ¤¤¤ë¤«È½Äꤹ¤ë¡£
356                $limit_time = ENTRY_LIMIT_HOUR * 3600;                     
357                if($pass_time < $limit_time) {
358                    $objErr->arrErr["email"] .= "¢¨ Âà²ñ¤«¤é°ìÄê´ü´Ö¤Î´Ö¤Ï¡¢Æ±¤¸¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò»ÈÍѤ¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£<br />";
359                }
360            }
361        }
362    }
363
364    $objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É", 'password', PASSWORD_LEN1, PASSWORD_LEN2), array("EXIST_CHECK", "SPTAB_CHECK" ,"ALNUM_CHECK", "NUM_RANGE_CHECK"));
365    $objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É³ÎǧÍѤμÁÌä", "reminder") ,array("SELECT_CHECK", "NUM_CHECK"));
366    $objErr->doFunc(array("¥Ñ¥¹¥ï¡¼¥É³ÎǧÍѤμÁÌä¤ÎÅú¤¨", "reminder_answer", STEXT_LEN) ,array("EXIST_CHECK","SPTAB_CHECK" , "MAX_LENGTH_CHECK"));
367   
368    return $objErr->arrErr;
369}
370
371//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
372function lfErrorCheck2($array) {
373
374    global $objConn, $objDate;
375    $objErr = new SC_CheckError($array);
376   
377    $objErr->doFunc(array("͹ÊØÈÖ¹æ1", "zip01", ZIP01_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
378    $objErr->doFunc(array("͹ÊØÈÖ¹æ2", "zip02", ZIP02_LEN ) ,array("EXIST_CHECK", "SPTAB_CHECK" ,"NUM_CHECK", "NUM_COUNT_CHECK"));
379    $objErr->doFunc(array("͹ÊØÈÖ¹æ", "zip01", "zip02"), array("ALL_EXIST_CHECK"));
380
381    $objErr->doFunc(array("À­ÊÌ", "sex") ,array("SELECT_CHECK", "NUM_CHECK"));
382    $objErr->doFunc(array("À¸Ç¯·îÆü (ǯ)", "year", 4), array("EXIST_CHECK", "SPTAB_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
383    if (!isset($objErr->arrErr['year'])) {
384        $objErr->doFunc(array("À¸Ç¯·îÆü (ǯ)", "year", $objDate->getStartYear()), array("MIN_CHECK"));
385        $objErr->doFunc(array("À¸Ç¯·îÆü (ǯ)", "year", $objDate->getEndYear()), array("MAX_CHECK"));
386    }
387    $objErr->doFunc(array("À¸Ç¯·îÆü (·îÆü)", "month", "day"), array("SELECT_CHECK"));
388    if (!isset($objErr->arrErr['year']) && !isset($objErr->arrErr['month']) && !isset($objErr->arrErr['day'])) {
389        $objErr->doFunc(array("À¸Ç¯·îÆü", "year", "month", "day"), array("CHECK_DATE"));
390    }
391   
392    return $objErr->arrErr;
393}
394
395//---- ÆþÎÏ¥¨¥é¡¼¥Á¥§¥Ã¥¯
396function lfErrorCheck3($array) {
397
398    global $objConn;
399    $objErr = new SC_CheckError($array);
400   
401    $objErr->doFunc(array("ÅÔÆ»Éܸ©", 'pref'), array("SELECT_CHECK","NUM_CHECK"));
402    $objErr->doFunc(array("»Ô¶èĮ¼", "addr01", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
403    $objErr->doFunc(array("ÈÖÃÏ", "addr02", MTEXT_LEN), array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
404    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ1", 'tel01'), array("EXIST_CHECK","SPTAB_CHECK" ));
405    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ2", 'tel02'), array("EXIST_CHECK","SPTAB_CHECK" ));
406    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ3", 'tel03'), array("EXIST_CHECK","SPTAB_CHECK" ));
407    $objErr->doFunc(array("ÅÅÏÃÈÖ¹æ", "tel01", "tel02", "tel03",TEL_ITEM_LEN) ,array("TEL_CHECK"));
408   
409    return $objErr->arrErr;
410}
411
412//³Îǧ¥Ú¡¼¥¸Íѥѥ¹¥ï¡¼¥Éɽ¼¨ÍÑ
413
414function lfPassLen($passlen){
415    $ret = "";
416    for ($i=0;$i<$passlen;true){
417    $ret.="*";
418    $i++;
419    }
420    return $ret;
421}
422
423
424// ͹ÊØÈֹ椫¤é½»½ê¤Î¼èÆÀ
425function lfGetAddress($zipcode) {
426    global $arrPref;
427
428    $conn = new SC_DBconn(ZIP_DSN);
429
430    // ͹ÊØÈֹ渡º÷ʸºîÀ®
431    $zipcode = mb_convert_kana($zipcode ,"n");
432    $sqlse = "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
433
434    $data_list = $conn->getAll($sqlse, array($zipcode));
435
436    // ¥¤¥ó¥Ç¥Ã¥¯¥¹¤ÈÃͤòȿž¤µ¤»¤ë¡£
437    $arrREV_PREF = array_flip($arrPref);
438
439    /*
440        Áí̳¾Ê¤«¤é¥À¥¦¥ó¥í¡¼¥É¤·¤¿¥Ç¡¼¥¿¤ò¤½¤Î¤Þ¤Þ¥¤¥ó¥Ý¡¼¥È¤¹¤ë¤È
441        °Ê²¼¤Î¤è¤¦¤Êʸ»úÎó¤¬Æþ¤Ã¤Æ¤¤¤ë¤Î¤Ç  Âкö¤¹¤ë¡£
442        ¡¦¡Ê£±¡¦£±£¹ÃúÌÜ¡Ë
443        ¡¦°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç
444    */
445    $town =  $data_list[0]['town'];
446    $town = ereg_replace("¡Ê.*¡Ë$","",$town);
447    $town = ereg_replace("°Ê²¼¤Ë·ÇºÜ¤¬¤Ê¤¤¾ì¹ç","",$town);
448    $data_list[0]['town'] = $town;
449    $data_list[0]['state'] = $arrREV_PREF[$data_list[0]['state']];
450
451    return $data_list;
452}
453
454//¸ÜµÒ¾ðÊó¤Î¼èÆÀ
455function lfGetCustomerData(){
456    global $objQuery;
457    global $objCustomer;
458    //¸ÜµÒ¾ðÊó¼èÆÀ
459    $ret = $objQuery->select("*","dtb_customer","customer_id=?", array($objCustomer->getValue('customer_id')));
460    $arrForm = $ret[0];
461    $arrForm['email'] = $arrForm['email_mobile'];
462
463    //¥á¥ë¥Þ¥¬¥Õ¥é¥°¼èÆÀ
464    $arrForm['mailmaga_flg'] = $objQuery->get("dtb_customer","mailmaga_flg","email=?", array($objCustomer->getValue('email_mobile')));
465   
466    //ÃÂÀ¸Æü¤Îǯ·îÆü¼èÆÀ
467    if (isset($arrForm['birth'])){
468        $birth = split(" ", $arrForm["birth"]);
469        list($year, $month, $day) = split("-",$birth[0]);
470       
471        $arrForm['year'] = $year;
472        $arrForm['month'] = $month;
473        $arrForm['day'] = $day;
474       
475    }
476    return $arrForm;
477}
478
479
480//-----------------------------------------------------------------------------------------------------------------------------------
481?>
Note: See TracBrowser for help on using the repository browser.