/** * Page のアクション. * * @return void */ function action() { // 会員管理クラス $objCustomer = new SC_Customer_Ex(); // クッキー管理クラス $objCookie = new SC_Cookie_Ex(); // パラメーター管理クラス $objFormParam = new SC_FormParam_Ex(); // パラメーター情報の初期化 $this->lfInitParam($objFormParam); // リクエスト値をフォームにセット $objFormParam->setParam($_POST); $url = htmlspecialchars($_POST['url'], ENT_QUOTES); // モードによって分岐 switch ($this->getMode()) { case 'login': // --- ログイン // 入力値のエラーチェック $objFormParam->trimParam(); $objFormParam->toLower('login_email'); $arrErr = $objFormParam->checkError(); // エラーの場合はエラー画面に遷移 if (count($arrErr) > 0) { if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR); SC_Response_Ex::actionExit(); } else { SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); SC_Response_Ex::actionExit(); } } // 入力チェック後の値を取得 $arrForm = $objFormParam->getHashArray(); // クッキー保存判定 if ($arrForm['login_memory'] == '1' && $arrForm['login_email'] != '') { $objCookie->setCookie('login_email', $arrForm['login_email']); } else { $objCookie->setCookie('login_email', ''); } // 遷移先の制御 if (count($arrErr) == 0) { // ログイン処理 if ($objCustomer->doLogin($arrForm['login_email'], $arrForm['login_pass'])) { if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) { // ログインが成功した場合は携帯端末IDを保存する。 $objCustomer->updateMobilePhoneId(); /* * email がモバイルドメインでは無く, * 携帯メールアドレスが登録されていない場合 */ $objMobile = new SC_Helper_Mobile_Ex(); if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) { if (!$objCustomer->hasValue('email_mobile')) { SC_Response_Ex::sendRedirectFromUrlPath('entry/email_mobile.php'); SC_Response_Ex::actionExit(); } } } // --- ログインに成功した場合 if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo SC_Utils_Ex::jsonEncode(array('success' => $url)); } else { SC_Response_Ex::sendRedirect($url); } SC_Response_Ex::actionExit(); } else { // --- ログインに失敗した場合 // ブルートフォースアタック対策 // ログイン失敗時に遅延させる sleep(LOGIN_RETRY_INTERVAL); $arrForm['login_email'] = strtolower($arrForm['login_email']); $objQuery = SC_Query_Ex::getSingletonInstance(); $where = '(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0'; $exists = $objQuery->exists('dtb_customer', $where, array($arrForm['login_email'], $arrForm['login_email'])); // ログインエラー表示 TODO リファクタリング if ($exists) { if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR); SC_Response_Ex::actionExit(); } else { SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); SC_Response_Ex::actionExit(); } } else { if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR); SC_Response_Ex::actionExit(); } else { SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR); SC_Response_Ex::actionExit(); } } } } else { // XXX 到達しない? // 入力エラーの場合、元のアドレスに戻す。 SC_Response_Ex::sendRedirect($url); SC_Response_Ex::actionExit(); } break; case 'logout': // --- ログアウト // ログイン情報の解放 $objCustomer->EndSession(); // 画面遷移の制御 $mypage_url_search = strpos('.' . $url, 'mypage'); if ($mypage_url_search == 2) { // マイページログイン中はログイン画面へ移行 SC_Response_Ex::sendRedirectFromUrlPath('mypage/login.php'); } else { // 上記以外の場合、トップへ遷移 SC_Response_Ex::sendRedirect(HTTP_URL); } SC_Response_Ex::actionExit(); break; default: break; } }
function MOBILE_EMAIL_CHECK($value) { if (isset($this->arrErr[$value[1]])) { return; } $this->createParam($value); $objMobile = new SC_Helper_Mobile_Ex(); if (strlen($this->arrParam[$value[1]]) > 0 && !$objMobile->gfIsMobileMailAddress($this->arrParam[$value[1]])) { $this->arrErr[$value[1]] = '※ ' . $value[0] . 'は携帯電話のものではありません。<br />'; } }
public function MOBILE_EMAIL_CHECK($value) { $disp_name = $value[0]; $keyname = $value[1]; if (isset($this->arrErr[$keyname])) { return; } $this->createParam($value); $objMobile = new SC_Helper_Mobile_Ex(); $input_var = $this->arrParam[$keyname]; if (strlen($input_var) > 0 && !$objMobile->gfIsMobileMailAddress($input_var)) { $this->arrErr[$keyname] = "※ {$disp_name}は携帯電話のものではありません。<br />"; } }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $objQuery = new SC_Query(); $objCustomer = new SC_Customer(); // クッキー管理クラス $objCookie = new SC_Cookie(COOKIE_EXPIRE); // パラメータ管理クラス $objFormParam = new SC_FormParam(); // パラメータ情報の初期化 $this->lfInitParam($objFormParam); // POST値の取得 $objFormParam->setParam($_POST); // 携帯端末IDが一致する会員が存在するかどうかをチェックする。 $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId(); if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } // ログイン処理 if ($_POST['mode'] == 'login') { $objFormParam->toLower('login_email'); $arrErr = $objFormParam->checkError(); $arrForm = $objFormParam->getHashArray(); // クッキー保存判定 if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") { $objCookie->setCookie('login_email', $_POST['login_email']); } else { $objCookie->setCookie('login_email', ''); } if (count($arrErr) == 0) { if ($objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) || $objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) { // ログインが成功した場合は携帯端末IDを保存する。 $objCustomer->updateMobilePhoneId(); /* * email がモバイルドメインでは無く, * 携帯メールアドレスが登録されていない場合 */ $objMobile = new SC_Helper_Mobile_Ex(); if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) { if (!$objCustomer->hasValue('email_mobile')) { $this->sendRedirect($this->getLocation("../entry/email_mobile.php"), true); exit; } } } else { $objQuery = new SC_Query(); $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0"; $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email'])); if ($ret > 0) { SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true); } else { SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true); } } } } /* * ログインチェック * 携帯メールの登録を必須にする場合は isLoginSuccess(false) にする */ if (!$objCustomer->isLoginSuccess(true)) { $this->tpl_mainpage = 'mypage/login.tpl'; $objView->assignArray($objFormParam->getHashArray()); if (empty($arrErr)) { $arrErr = array(); } $objView->assignArray(array("arrErr" => $arrErr)); } else { //マイページトップ顧客情報表示用 $this->CustomerName1 = $objCustomer->getvalue('name01'); $this->CustomerName2 = $objCustomer->getvalue('name02'); } $objView->assignobj($this); //$objpage内の全てのテンプレート変数をsmartyに格納 $objView->display(SITE_FRAME); //パスとテンプレート変数の呼び出し、実行 }
/** * email から email_mobile へ携帯のメールアドレスをコピーする。 * * @return void */ function updateEmailMobile() { $objMobile = new SC_Helper_Mobile_Ex(); // すでに email_mobile に値が入っている場合は何もしない。 if ($this->customer_data['email_mobile'] != '') { return; } // email が携帯のメールアドレスではない場合は何もしない。 if (!$objMobile->gfIsMobileMailAddress($this->customer_data['email'])) { return; } // email から email_mobile へコピーする。 $objQuery = new SC_Query(); $sqlval = array('email_mobile' => $this->customer_data['email']); $where = 'customer_id = ? AND del_flg = 0 AND status = 2'; $objQuery->update('dtb_customer', $sqlval, $where, array($this->customer_data['customer_id'])); $this->customer_data['email_mobile'] = $this->customer_data['email']; }
function MOBILE_EMAIL_CHECK($value) { if (isset($this->arrErr[$value[1]])) { return; } $this->createParam($value); $objMobile = new SC_Helper_Mobile_Ex(); if (strlen($this->arrParam[$value[1]]) > 0 && !$objMobile->gfIsMobileMailAddress($this->arrParam[$value[1]])) { $this->arrErr[$value[1]] = t('c_* T_ARG1 is not for mobile phones. <br />_01', array('T_ARG1' => $value[0])); } }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $objSiteSess = new SC_SiteSession(); $objCartSess = new SC_CartSession(); $objCustomer = new SC_Customer(); // クッキー管理クラス $objCookie = new SC_Cookie(COOKIE_EXPIRE); // パラメータ管理クラス $this->objFormParam = new SC_FormParam(); // パラメータ情報の初期化 $this->lfInitParam(); // POST値の取得 $this->lfConvertEmail($_POST["login_email"]); $this->lfConvertLoginPass($_POST["login_pass"]); $this->objFormParam->setParam($_POST); $this->objLoginFormParam = new SC_FormParam(); // ログインフォーム用 $this->lfInitLoginFormParam(); // 初期設定 $this->objLoginFormParam->setParam($_POST); // POST値の取得 // ユーザユニークIDの取得と購入状態の正当性をチェック $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess); $this->tpl_uniqid = $uniqid; if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } // ログインチェック if ($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess(true)) { // 不正アクセスとみなす SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true); } switch ($_POST['mode']) { case 'login': $this->objLoginFormParam->toLower('login_email'); $this->arrErr = $this->objLoginFormParam->checkError(); $arrForm = $this->objLoginFormParam->getHashArray(); // クッキー保存判定 if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") { $objCookie->setCookie('login_email', $_POST['login_email']); } else { $objCookie->setCookie('login_email', ''); } if (count($this->arrErr) == 0) { // ログイン判定 if (!$objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) && !$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) { // 仮登録の判定 $objQuery = new SC_Query(); $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0"; $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email'])); if ($ret > 0) { SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true); } else { SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true); } } } else { // ログインページに戻る $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_TOP), true); exit; } // ログインが成功した場合は携帯端末IDを保存する。 $objCustomer->updateMobilePhoneId(); /* * 携帯メールアドレスが登録されていない場合は, * 携帯メールアドレス登録画面へ遷移 */ $objMobile = new SC_Helper_Mobile_Ex(); if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) { if (!$objCustomer->hasValue('email_mobile')) { $this->sendRedirect($this->getLocation("../entry/email_mobile.php"), true); exit; } } break; // 削除 // 削除 case 'delete': if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) { $objQuery = new SC_Query(); $where = "other_deliv_id = ?"; $arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id'])); $this->objFormParam->setValue('select_addr_id', ''); } break; // 会員登録住所に送る // 会員登録住所に送る case 'customer_addr': // お届け先がチェックされている場合には更新処理を行う if ($_POST['deli'] != "") { // 会員情報の住所を受注一時テーブルに書き込む $this->lfRegistDelivData($uniqid, $objCustomer); // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); // お支払い方法選択ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true); exit; } else { // エラーを返す $arrErr['deli'] = '※ お届け先を選択してください。'; } break; // 登録済みの別のお届け先に送る // 登録済みの別のお届け先に送る case 'other_addr': // お届け先がチェックされている場合には更新処理を行う if ($_POST['deli'] != "") { if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) { $objQuery = new SC_Query(); $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=? and other_deliv_id = ?", array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id'])); if ($deliv_count != 1) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } // 登録済みの別のお届け先を受注一時テーブルに書き込む $this->lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['other_deliv_id']); // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); // お支払い方法選択ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true); exit; } } else { // エラーを返す $arrErr['deli'] = '※ お届け先を選択してください。'; } break; // 前のページに戻る // 前のページに戻る case 'return': // 確認ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_CART_TOP), true); exit; break; default: $objQuery = new SC_Query(); $where = "order_temp_id = ?"; $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid)); $this->objFormParam->setParam($arrRet[0]); break; } /** 表示処理 **/ // 会員登録住所の取得 $col = "name01, name02, pref, addr01, addr02, zip01, zip02"; $where = "customer_id = ?"; $objQuery = new SC_Query(); $arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id'])); // 別のお届け先住所の取得 $col = "other_deliv_id, name01, name02, pref, addr01, addr02, zip01, zip02"; $objQuery->setorder("other_deliv_id DESC"); $objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id'])); $this->arrAddr = $arrCustomerAddr; $cnt = 1; foreach ($objOtherAddr as $val) { $this->arrAddr[$cnt] = $val; $cnt++; } // 入力値の取得 if (!isset($arrErr)) { $arrErr = array(); } $this->arrForm = $this->objFormParam->getFormParamList(); $this->arrErr = $arrErr; $objView->assignobj($this); $objView->display(SITE_FRAME); }