source: temp/branches/mobile/html/mobile/entry/email_mobile.php @ 11415

Revision 11415, 3.5 KB checked in by rebelt, 15 years ago (diff)

携帯以外のメールアドレスでログインした場合に携帯のアドレスを
登録させるようにしました。

  • Property svn:eol-style set to native
Line 
1<?php
2/**
3 * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/·ÈÂӥ᡼¥ëÅÐÏ¿
4 */
5
6require_once('../require.php');
7
8class LC_Page {
9    function LC_Page() {
10        $this->tpl_mainpage = 'entry/email_mobile.tpl';
11        $this->tpl_title = '·ÈÂӥ᡼¥ëÅÐÏ¿';
12        /*
13         session_start»þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç
14         ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤ÎÍ­¸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£
15         private-no-expire:¥¯¥é¥¤¥¢¥ó¥È¤Î¥­¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£
16        */
17        session_cache_limiter('private-no-expire');     
18    }
19}
20
21$objPage = new LC_Page;
22$objView = new SC_SiteView;
23$objCustomer = new SC_Customer;
24$objFormParam = new SC_FormParam;
25
26if (isset($_SESSION['mobile']['kara_mail_from'])) {
27    $_SERVER['REQUEST_METHOD'] = 'POST';
28    $_POST['email_mobile'] = $_SESSION['mobile']['kara_mail_from'];
29}
30
31lfInitParam($objFormParam);
32
33if ($_SERVER['REQUEST_METHOD'] == 'POST') {
34    $objFormParam->setParam($_POST);
35    $objFormParam->convParam();
36    $objPage->arrErr = lfCheckError($objFormParam, $objCustomer);
37
38    if (empty($arrRet)) {
39        lfRegister($objFormParam, $objCustomer);
40        $objPage->tpl_mainpage = 'entry/email_mobile_complete.tpl';
41        $objPage->tpl_title = '·ÈÂӥ᡼¥ëÅÐÏ¿´°Î»';
42    }
43}
44
45// ¶õ¥á¡¼¥ëÍѤΥȡ¼¥¯¥ó¤òºîÀ®¤¹¤ë¡£
46if (MOBILE_USE_KARA_MAIL) {
47    $token = gfPrepareKaraMail('entry/email_mobile.php');
48    if ($token !== false) {
49        $objPage->tpl_kara_mail_to = MOBILE_KARA_MAIL_ADDRESS_USER . MOBILE_KARA_MAIL_ADDRESS_DELIMITER . 'entry_' . $token . '@' . MOBILE_KARA_MAIL_ADDRESS_DOMAIN;
50    }
51}
52
53$objPage->tpl_name = $objCustomer->getValue('name01');
54$objPage->arrForm = $objFormParam->getFormParamList();
55
56$objView->assignobj($objPage);
57$objView->display(SITE_FRAME);
58
59//-----------------------------------------------------------------------------------------------------------------------------------
60
61function lfInitParam(&$objFormParam) {
62    $objFormParam->addParam('¥á¡¼¥ë¥¢¥É¥ì¥¹', 'email_mobile', MTEXT_LEN, 'a',
63        array('NO_SPTAB', 'EXIST_CHECK', 'MAX_LENGTH_CHECK', 'CHANGE_LOWER', 'EMAIL_CHAR_CHECK', 'MOBILE_EMAIL_CHECK'));
64}
65
66function lfCheckError(&$objFormParam, &$objCustomer) {
67    $arrRet = $objFormParam->getHashArray();
68    $objErr = new SC_CheckError($arrRet);
69    $objErr->arrErr = $objFormParam->checkError();
70
71    if (count($objErr->arrErr) > 0) {
72        return $objErr->arrErr;
73    }
74
75    $email_mobile = $objFormParam->getValue('email_mobile');
76    $customer_id = $objCustomer->getValue('customer_id');
77    $objQuery = new SC_Query();
78    $arrRet = $objQuery->select('email, email_mobile, update_date, del_flg', 'dtb_customer', '(email ILIKE ? OR email_mobile ILIKE ?) AND customer_id <> ? ORDER BY del_flg', array($email_mobile, $email_mobile, $customer_id));
79
80    if (count($arrRet) > 0) {
81        if ($arrRet[0]['del_flg'] != '1') {
82            // ²ñ°÷¤Ç¤¢¤ë¾ì¹ç
83            $objErr->arrErr['email_mobile'] .= '¢¨ ¤¹¤Ç¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ç¤¹¡£<br>';
84        } else {
85            // Âà²ñ¤·¤¿²ñ°÷¤Ç¤¢¤ë¾ì¹ç
86            $leave_time = sfDBDatetoTime($arrRet[0]['update_date']);
87            $now_time = time();
88            $pass_time = $now_time - $leave_time;
89            // Âà²ñ¤«¤é²¿»þ´Ö-·Ð²á¤·¤Æ¤¤¤ë¤«È½Äꤹ¤ë¡£
90            $limit_time = ENTRY_LIMIT_HOUR * 3600;
91            if ($pass_time < $limit_time) {
92                $objErr->arrErr['email_mobile'] .= '¢¨ Âà²ñ¤«¤é°ìÄê´ü´Ö¤Î´Ö¤Ï¡¢Æ±¤¸¥á¡¼¥ë¥¢¥É¥ì¥¹¤ò»ÈÍѤ¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£<br>';
93            }
94        }
95    }
96
97    return $objErr->arrErr;
98}
99
100function lfRegister(&$objFormParam, &$objCustomer)
101{
102    $customer_id = $objCustomer->getValue('customer_id');
103    $email_mobile = $objFormParam->getValue('email_mobile');
104
105    $objQuery = new SC_Query();
106    $objQuery->update('dtb_customer', array('email_mobile' => $email_mobile), 'customer_id = ?', array($customer_id));
107
108    $objCustomer->setValue('email_mobile', $email_mobile);
109}
110?>
Note: See TracBrowser for help on using the repository browser.