Source for file LC_Page_Entry.php

Documentation is available at LC_Page_Entry.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.lockon.co.jp/
  8.  *
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  */
  23.  
  24. // {{{ requires
  25. require_once(CLASS_PATH "pages/LC_Page.php");
  26.  
  27. /**
  28.  * 会員登録(入力ページ) のページクラス.
  29.  *
  30.  * @package Page
  31.  * @author LOCKON CO.,LTD.
  32.  * @version $Id:LC_Page_Entry.php 15532 2007-08-31 14:39:46Z nanasess $
  33.  */
  34. class LC_Page_Entry extends LC_Page {
  35.  
  36.     // }}}
  37.     // {{{ functions
  38.  
  39.     /**
  40.      * Page を初期化する.
  41.      *
  42.      * @return void 
  43.      */
  44.     function init({
  45.         parent::init();
  46.         $this->tpl_mainpage = 'entry/index.tpl';
  47.         $this->tpl_title .= '会員登録(入力ページ)';
  48.         $this->year "";
  49.         $masterData new SC_DB_MasterData_Ex();
  50.         $this->arrPref $masterData->getMasterData("mtb_pref",
  51.                                 array("pref_id""pref_name""rank"));
  52.         $this->arrJob $masterData->getMasterData("mtb_job");
  53.         $this->arrReminder $masterData->getMasterData("mtb_reminder");
  54.         
  55.         // 生年月日選択肢の取得
  56.         $objDate new SC_Date(START_BIRTH_YEARdate("Y",strtotime("now")));
  57.         $this->arrYear $objDate->getYear(''1950'');
  58.         $this->arrMonth $objDate->getMonth(true);
  59.         $this->arrDay $objDate->getDay(true);
  60.     }
  61.  
  62.     /**
  63.      * Page のプロセス.
  64.      *
  65.      * @return void 
  66.      */
  67.     function process({
  68.         global $objCampaignSess;
  69.  
  70.         $objConn new SC_DbConn();
  71.         $objView new SC_SiteView();
  72.         $objCustomer new SC_Customer();
  73.         $objCampaignSess new SC_CampaignSession();
  74.         $objDb new SC_Helper_DB_Ex();
  75.         $CONF $objDb->sf_getBasisData();
  76.  
  77.         // 規約ページからの遷移でなければエラー画面へ遷移する
  78.         if (empty($_POST&& !preg_match('/kiyaku.php/'basename($_SERVER['HTTP_REFERER']))) {
  79.             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR""true);
  80.         }
  81.  
  82.         // レイアウトデザインを取得
  83.         $objLayout new SC_Helper_PageLayout_Ex();
  84.         $objLayout->sfGetPageLayout($thisfalseDEF_LAYOUT);
  85.  
  86.         //---- 登録用カラム配列
  87.         $arrRegistColumn array(
  88.                                      array(  "column" => "name01""convert" => "aKV" ),
  89.                                      array(  "column" => "name02""convert" => "aKV" ),
  90.                                      array(  "column" => "kana01""convert" => "CKV" ),
  91.                                      array(  "column" => "kana02""convert" => "CKV" ),
  92.                                      array(  "column" => "zip01""convert" => "n" ),
  93.                                      array(  "column" => "zip02""convert" => "n" ),
  94.                                      array(  "column" => "pref""convert" => "n" ),
  95.                                      array(  "column" => "addr01""convert" => "aKV" ),
  96.                                      array(  "column" => "addr02""convert" => "aKV" ),
  97.                                      array(  "column" => "email""convert" => "a" ),
  98.                                      array(  "column" => "email2""convert" => "a" ),
  99.                                      array(  "column" => "email_mobile""convert" => "a" ),
  100.                                      array(  "column" => "email_mobile2""convert" => "a" ),
  101.                                      array(  "column" => "tel01""convert" => "n" ),
  102.                                      array(  "column" => "tel02""convert" => "n" ),
  103.                                      array(  "column" => "tel03""convert" => "n" ),
  104.                                      array(  "column" => "fax01""convert" => "n" ),
  105.                                      array(  "column" => "fax02""convert" => "n" ),
  106.                                      array(  "column" => "fax03""convert" => "n" ),
  107.                                      array(  "column" => "sex""convert" => "n" ),
  108.                                      array(  "column" => "job""convert" => "n" ),
  109.                                      array(  "column" => "birth""convert" => "n" ),
  110.                                      array(  "column" => "reminder""convert" => "n" ),
  111.                                      array(  "column" => "reminder_answer""convert" => "aKV"),
  112.                                      array(  "column" => "password""convert" => "a" ),
  113.                                      array(  "column" => "password02""convert" => "a" ),
  114.                                      array(  "column" => "mailmaga_flg""convert" => "n" ),
  115.                                  );
  116.  
  117.         //---- 登録除外用カラム配列
  118.         $arrRejectRegistColumn array("year""month""day""email02""email_mobile02""password02");
  119.  
  120.         if ($_SERVER["REQUEST_METHOD"== "POST"{
  121.  
  122.             if (!$this->isValidToken()) {
  123.                 SC_Utils_Ex::sfDispSiteError(PAGE_ERROR""true);
  124.             }
  125.  
  126.             //-- POSTデータの引き継ぎ
  127.             $this->arrForm $_POST;
  128.             $this->arrForm['email'strtolower($this->arrForm['email']);        // emailはすべて小文字で処理
  129.             $this->arrForm['email02'strtolower($this->arrForm['email02']);    // emailはすべて小文字で処理
  130.  
  131.             //-- 入力データの変換
  132.             $this->arrForm $this->lfConvertParam($this->arrForm$arrRegistColumn);
  133.  
  134.             //-- 入力エラーチェック
  135.             $this->arrErr $this->lfErrorCheck($this->arrForm);
  136.  
  137.             if ($this->arrErr || $_POST["mode"== "return"{        // 入力エラーのチェック
  138.                 foreach($this->arrForm as $key => $val{
  139.                     $this->$key $val;
  140.                 }
  141.  
  142.             else {
  143.  
  144.                 //-- 確認
  145.                 if ($_POST["mode"== "confirm"{
  146.                     foreach($this->arrForm as $key => $val{
  147.                         if ($key != "mode" && $key != "subm"$this->list_data$key $val;
  148.                     }
  149.                     //パスワード表示
  150.                     $passlen strlen($this->arrForm['password']);
  151.                     $this->passlen SC_Utils_Ex::lfPassLen($passlen);
  152.  
  153.                     $this->tpl_css = '/css/layout/entry/confirm.css';
  154.                     $this->tpl_mainpage = 'entry/confirm.tpl';
  155.                     $this->tpl_title = '会員登録(確認ページ)';
  156.  
  157.                 }
  158.  
  159.                 //-- 会員登録と完了画面
  160.                 if ($_POST["mode"== "complete"{
  161.                     // キャンペーンからの遷移の時用の値
  162.                     if($objCampaignSess->getIsCampaign()) {
  163.                         $this->etc_value "&cp=".$objCampaignSess->getCampaignId();
  164.                     }
  165.  
  166.                     // 会員情報の登録
  167.                     $this->CONF $CONF;
  168.                     $this->uniqid $this->lfRegistData ($this->arrForm$arrRegistColumn$arrRejectRegistColumnCUSTOMER_CONFIRM_MAIL);
  169.  
  170.                     $this->tpl_css = '/css/layout/entry/complete.css';
  171.                     $this->tpl_mainpage = 'entry/complete.tpl';
  172.                     $this->tpl_title = '会員登録(完了ページ)';
  173.  
  174.                     // 完了メール送信
  175.                     $this->name01 $_POST['name01'];
  176.                     $this->name02 $_POST['name02'];
  177.                     $objMailText new SC_SiteView();
  178.                     $objMailText->assignobj($this);
  179.  
  180.                     $objHelperMail new SC_Helper_Mail_Ex();
  181.                     $objQuery new SC_Query();
  182.  
  183.                     // 仮会員が有効の場合
  184.                     if(CUSTOMER_CONFIRM_MAIL == true{
  185.                         $subject $objHelperMail->sfMakeSubject('会員登録のご確認');
  186.                         $toCustomerMail $objMailText->fetch("mail_templates/customer_mail.tpl");
  187.                     else {
  188.                         $subject $objHelperMail->sfMakeSubject('会員登録のご完了');
  189.                         $toCustomerMail $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
  190.                         // ログイン状態にする
  191.                         $objCustomer->setLogin($_POST["email"]);
  192.                     }
  193.  
  194.                     $objMail new SC_SendMail();
  195.                     $objMail->setItem(
  196.                                           ''                    // 宛先
  197.                                         $subject              // サブジェクト
  198.                                         $toCustomerMail       // 本文
  199.                                         $CONF["email03"]      // 配送元アドレス
  200.                                         $CONF["shop_name"]    // 配送元 名前
  201.                                         $CONF["email03"]      // reply_to
  202.                                         $CONF["email04"]      // return_path
  203.                                         $CONF["email04"]      // Errors_to
  204.                                         $CONF["email01"]      // Bcc
  205.                     );
  206.                     // 宛先の設定
  207.                     $name $_POST["name01"$_POST["name02"." 様";
  208.                     $objMail->setTo($_POST["email"]$name);
  209.                     $objMail->sendMail();
  210.  
  211.                     // 完了ページに移動させる。
  212.                     $customer_id $objQuery->get("dtb_customer""customer_id""secret_key = ?"array($this->uniqid));
  213.                     $this->sendRedirect($this->getLocation("./complete.php"array("ci" => $customer_id)));
  214.                     exit;
  215.                 }
  216.             }
  217.         }
  218.  
  219.         $this->transactionid = $this->getToken();
  220.  
  221.         //---- ページ表示
  222.         $objView->assignobj($this);
  223.         // フレームを選択(キャンペーンページから遷移なら変更)
  224.         $objCampaignSess->pageView($objView);
  225.     }
  226.  
  227.     /**
  228.      * モバイルページを初期化する.
  229.      *
  230.      * @return void 
  231.      */
  232.     function mobileInit({
  233.         $this->init();
  234.         $this->tpl_mainpage = 'entry/index.tpl';        // メインテンプレート
  235.         $this->tpl_title .= '会員登録(1/3)';            // ページタイトル
  236.     }
  237.  
  238.     /**
  239.      * Page のプロセス(モバイル).
  240.      *
  241.      * @return void 
  242.      */
  243.     function mobileProcess({
  244.         //---- ページ初期設定
  245.         $objDb new SC_Helper_DB_Ex();
  246.         $objMobile new SC_Helper_Mobile_Ex();
  247.         $CONF $objDb->sf_getBasisData();                    // 店舗基本情報
  248.         $objConn new SC_DbConn();
  249.         $objView new SC_MobileView();
  250.         $objCustomer new SC_Customer();
  251.  
  252.         // 空メール
  253.         if (isset($_SESSION['mobile']['kara_mail_from'])) {
  254.             $_POST['email'$_SESSION['mobile']['kara_mail_from'];
  255.             $this->tpl_kara_mail_from $_POST['email'];
  256.         elseif (MOBILE_USE_KARA_MAIL{
  257.             $token $objMobile->gfPrepareKaraMail('entry/' DIR_INDEX_URL);
  258.             if ($token !== false{
  259.                 $this->tpl_mainpage = 'entry/mail.tpl';
  260.                 $this->tpl_title = '会員登録(空メール)';
  261.                 $this->tpl_kara_mail_to MOBILE_KARA_MAIL_ADDRESS_USER MOBILE_KARA_MAIL_ADDRESS_DELIMITER 'entry_' $token '@' MOBILE_KARA_MAIL_ADDRESS_DOMAIN;
  262.                 $this->tpl_from_address $CONF['email03'];
  263.             }
  264.         }
  265.  
  266.         // レイアウトデザインを取得
  267.         $objLayout new SC_Helper_PageLayout_Ex();
  268.         $objLayout->sfGetPageLayout($thisfalseDEF_LAYOUT);
  269.  
  270.         //---- 登録用カラム配列
  271.         $arrRegistColumn array(
  272.                                  array(  "column" => "name01""convert" => "aKV" ),
  273.                                  array(  "column" => "name02""convert" => "aKV" ),
  274.                                  array(  "column" => "kana01""convert" => "CKV" ),
  275.                                  array(  "column" => "kana02""convert" => "CKV" ),
  276.                                  array(  "column" => "zip01""convert" => "n" ),
  277.                                  array(  "column" => "zip02""convert" => "n" ),
  278.                                  array(  "column" => "pref""convert" => "n" ),
  279.                                  array(  "column" => "addr01""convert" => "aKV" ),
  280.                                  array(  "column" => "addr02""convert" => "aKV" ),
  281.                                  array(  "column" => "email""convert" => "a" ),
  282.                                  array(  "column" => "email2""convert" => "a" ),
  283.                                  array(  "column" => "email_mobile""convert" => "a" ),
  284.                                  array(  "column" => "email_mobile2""convert" => "a" ),
  285.                                  array(  "column" => "tel01""convert" => "n" ),
  286.                                  array(  "column" => "tel02""convert" => "n" ),
  287.                                  array(  "column" => "tel03""convert" => "n" ),
  288.                                  array(  "column" => "fax01""convert" => "n" ),
  289.                                  array(  "column" => "fax02""convert" => "n" ),
  290.                                  array(  "column" => "fax03""convert" => "n" ),
  291.                                  array(  "column" => "sex""convert" => "n" ),
  292.                                  array(  "column" => "job""convert" => "n" ),
  293.                                  array(  "column" => "birth""convert" => "n" ),
  294.                                  array(  "column" => "reminder""convert" => "n" ),
  295.                                  array(  "column" => "reminder_answer""convert" => "aKV"),
  296.                                  array(  "column" => "password""convert" => "a" ),
  297.                                  array(  "column" => "password02""convert" => "a" ),
  298.                                  array(  "column" => "mailmaga_flg""convert" => "n" ),
  299.                                  );
  300.  
  301.         //---- 登録除外用カラム配列
  302.         $arrRejectRegistColumn array("year""month""day""email02""email_mobile02""password02");
  303.  
  304.         if ($_SERVER["REQUEST_METHOD"== "POST"{
  305.  
  306.             //-- POSTデータの引き継ぎ
  307.             $this->arrForm $_POST;
  308.             $this->arrForm['email'strtolower($this->arrForm['email']);        // emailはすべて小文字で処理
  309.  
  310.             //-- 入力データの変換
  311.             $this->arrForm $this->lfConvertParam($this->arrForm$arrRegistColumn);
  312.  
  313.             // 戻るボタン用処理
  314.             if (!empty($_POST["return"])) {
  315.                 switch ($_POST["mode"]{
  316.                 case "complete":
  317.                     $_POST["mode""set3";
  318.                     break;
  319.                 case "confirm":
  320.                     $_POST["mode""set2";
  321.                     break;
  322.                 default:
  323.                     $_POST["mode""set1";
  324.                     break;
  325.                 }
  326.             }
  327.  
  328.             //-- 入力エラーチェック
  329.             if ($_POST["mode"== "set1"{
  330.                 $this->arrErr $this->lfErrorCheck1($this->arrForm);
  331.                 $this->tpl_mainpage = 'entry/index.tpl';
  332.                 $this->tpl_title = '会員登録(1/3)';
  333.             elseif ($_POST["mode"== "set2"{
  334.                 $this->arrErr $this->lfErrorCheck2($this->arrForm);
  335.                 $this->tpl_mainpage = 'entry/set1.tpl';
  336.                 $this->tpl_title = '会員登録(2/3)';
  337.             else {
  338.                 $this->arrErr $this->lfErrorCheck3($this->arrForm);
  339.                 $this->tpl_mainpage = 'entry/set2.tpl';
  340.                 $this->tpl_title = '会員登録(3/3)';
  341.             }
  342.  
  343.             foreach($this->arrForm as $key => $val{
  344.                 $this->$key $val;
  345.             }
  346.  
  347.             if ($this->arrErr || !empty($_POST["return"])) {        // 入力エラーのチェック
  348.  
  349.                 //-- データの設定
  350.                 if ($_POST["mode"== "set1"{
  351.                     $checkVal array("email""password""reminder""reminder_answer""name01""name02""kana01""kana02");
  352.                 elseif ($_POST["mode"== "set2"{
  353.                     $checkVal array("sex""year""month""day""zip01""zip02");
  354.                 else {
  355.                     $checkVal array("pref""addr01""addr02""tel01""tel02""tel03""mailmaga_flg");
  356.                 }
  357.  
  358.                 foreach($this->arrForm as $key => $val{
  359.                     if ($key != "mode" && $key != "submit" && $key != "return" && $key != session_name(&& !in_array($key$checkVal))
  360.                         $this->list_data$key $val;
  361.                 }
  362.  
  363.  
  364.  
  365.             else {
  366.  
  367.                 //-- テンプレート設定
  368.                 if ($_POST["mode"== "set1"{
  369.                     $this->tpl_mainpage = 'entry/set1.tpl';
  370.                     $this->tpl_title = '会員登録(2/3)';
  371.                 elseif ($_POST["mode"== "set2"{
  372.                     $this->tpl_mainpage = 'entry/set2.tpl';
  373.                     $this->tpl_title = '会員登録(3/3)';
  374.  
  375.                     if (@$this->arrForm['pref'== "" && @$this->arrForm['addr01'== "" && @$this->arrForm['addr02'== ""{
  376.                         $address $this->lfGetAddress($_REQUEST['zip01'].$_REQUEST['zip02']);
  377.                         $this->pref @$address[0]['state'];
  378.                         $this->addr01 @$address[0]['city'@$address[0]['town'];
  379.                     }
  380.                 elseif ($_POST["mode"== "confirm"{
  381.                     //パスワード表示
  382.                     $passlen strlen($this->arrForm['password']);
  383.                     $this->passlen $this->lfPassLen($passlen);
  384.  
  385.                     //メール受け取り
  386.                     if (!isset($this->arrForm['mailmaga_flg'])) $this->arrForm['mailmaga_flg']  "";
  387.                     if (strtolower($this->arrForm['mailmaga_flg']== "on"{
  388.                         $this->arrForm['mailmaga_flg']  "2";
  389.                     else {
  390.                         $this->arrForm['mailmaga_flg']  "3";
  391.                     }
  392.  
  393.                     $this->tpl_mainpage = 'entry/confirm.tpl';
  394.                     $this->tpl_title = '会員登録(確認ページ)';
  395.  
  396.                 }
  397.  
  398.                 //-- データ設定
  399.                 unset($this->list_data);
  400.                 if ($_POST["mode"== "set1"{
  401.                     $checkVal array("sex""year""month""day""zip01""zip02");
  402.                 elseif ($_POST["mode"== "set2"{
  403.                     $checkVal array("pref""addr01""addr02""tel01""tel02""tel03""mailmaga_flg");
  404.                 else {
  405.                     $checkVal array();
  406.                 }
  407.  
  408.                 foreach($this->arrForm as $key => $val{
  409.                     if ($key != "mode" && $key != "submit" && $key != "confirm" && $key != "return" && $key != session_name(&& !in_array($key$checkVal)) {
  410.                         $this->list_data$key $val;
  411.                     }
  412.                 }
  413.  
  414.  
  415.                 //-- 仮登録と完了画面
  416.                 if ($_POST["mode"== "complete"{
  417.  
  418.                     // 確認画面で再度エラーチェックを行う。(画面1)
  419.                     $arrErr $this->lfErrorCheck1($this->arrForm);
  420.                     if(count($arrErr0){
  421.                         $this->tpl_mainpage = 'entry/index.tpl';
  422.                         $this->tpl_title = '会員登録(1/3)';
  423.                         $this->arrErr $arrErr;
  424.                         //---- ページ表示
  425.                         $objView->assignobj($this);
  426.                         $objView->display(SITE_FRAME);
  427.                         exit();
  428.                     }
  429.  
  430.                     // 確認画面で再度エラーチェックを行う。(画面2)
  431.                     $arrErr $this->lfErrorCheck2($this->arrForm);
  432.                     if(count($arrErr0){
  433.                         $this->tpl_mainpage = 'entry/set1.tpl';
  434.                         $this->tpl_title = '会員登録(2/3)';
  435.                         $this->arrErr $arrErr;
  436.                         //---- ページ表示
  437.                         $objView->assignobj($this);
  438.                         $objView->display(SITE_FRAME);
  439.                         exit();
  440.                     }
  441.  
  442.                     // 確認画面で再度エラーチェックを行う。(画面3)
  443.                     $arrErr $this->lfErrorCheck3($this->arrForm);
  444.                     if(count($arrErr0){
  445.                         $this->tpl_mainpage = 'entry/set2.tpl';
  446.                         $this->tpl_title = '会員登録(3/3)';
  447.                         $this->arrErr $arrErr;
  448.                         //---- ページ表示
  449.                         $objView->assignobj($this);
  450.                         $objView->display(SITE_FRAME);
  451.                         exit();
  452.                     }
  453.  
  454.                     $this->CONF $CONF;
  455.                     $this->uniqid $this->lfRegistData ($this->arrForm$arrRegistColumn$arrRejectRegistColumnCUSTOMER_CONFIRM_MAILtrue$this->arrForm["email"]);
  456.  
  457.                     // 空メールを受信済みの場合はすぐに本登録完了にする。
  458.                     if (isset($_SESSION['mobile']['kara_mail_from'])) {
  459.                         $param array("mode" => "regist",
  460.                                        "id" => $this->uniqid,
  461.                                        session_name(=> session_id());
  462.                         $this->sendRedirect($this->getLocation(MOBILE_URL_DIR "regist/" DIR_INDEX_URL$param));
  463.                         exit;
  464.                     }
  465.  
  466.                     $this->tpl_mainpage = 'entry/complete.tpl';
  467.                     $this->tpl_title = '会員登録(完了ページ)';
  468.  
  469.                     $objMobile->sfMobileSetExtSessionId('id'$this->uniqid'regist/' DIR_INDEX_URL);
  470.  
  471.                     // 仮登録完了メール送信
  472.                     $this->to_name01 $_POST['name01'];
  473.                     $this->to_name02 $_POST['name02'];
  474.                     $objMailText new SC_MobileView();
  475.                     $objMailText->assignobj($this);
  476.                     $objHelperMail new SC_Helper_Mail_Ex();
  477.                     $objQuery new SC_Query();
  478.  
  479.                     // 仮会員が有効の場合
  480.                     if(CUSTOMER_CONFIRM_MAIL == true{
  481.                         // Moba8パラメーターを保持する場合はカラム追加
  482.                         if (isset($_SESSION['a8'])) $this->etc_value "&a8="$_SESSION['a8'];
  483.                         $subject $objHelperMail->sfMakeSubject('会員登録のご確認');
  484.                         $toCustomerMail $objMailText->fetch("mail_templates/customer_mail.tpl");
  485.                     else {
  486.                         $subject $objHelperMail->sfMakeSubject('会員登録のご完了');
  487.                         $toCustomerMail $objMailText->fetch("mail_templates/customer_regist_mail.tpl");
  488.                         // ログイン状態にする
  489.                         $objCustomer->setLogin($_POST["email"]);
  490.                     }
  491.  
  492.                     $objMail new SC_SendMail();
  493.                     $objMail->setItem(
  494.                                         ''                  // 宛先
  495.                                       $subject            // サブジェクト
  496.                                       $toCustomerMail     // 本文
  497.                                       $CONF["email03"]    // 配送元アドレス
  498.                                       $CONF["shop_name"]  // 配送元 名前
  499.                                       $CONF["email03"]    // reply_to
  500.                                       $CONF["email04"]    // return_path
  501.                                       $CONF["email04"]    // Errors_to
  502.                                       $CONF["email01"]    // Bcc
  503.                     );
  504.                     // 宛先の設定
  505.                     $name $_POST["name01"$_POST["name02"." 様";
  506.                     $objMail->setTo($_POST["email"]$name);
  507.                     $objMail->sendMail();
  508.  
  509.                     // 完了ページに移動させる。
  510.                     $this->sendRedirect($this->getLocation("./complete.php")true);
  511.                     exit;
  512.                 }
  513.             }
  514.         }
  515.  
  516.         //---- ページ表示
  517.         $objView->assignobj($this);
  518.         $objView->display(SITE_FRAME);
  519.     }
  520.  
  521.     /**
  522.      * デストラクタ.
  523.      *
  524.      * @return void 
  525.      */
  526.     function destroy({
  527.         parent::destroy();
  528.     }
  529.  
  530.     // }}}
  531.     // {{{ protected functions
  532.  
  533.     // 会員情報の登録
  534.     function lfRegistData ($array$arrRegistColumn$arrRejectRegistColumn$confirm_flg$isMobile false$email_mobile ""{
  535.         $objConn new SC_DbConn();
  536.  
  537.         // 登録データの生成
  538.         foreach ($arrRegistColumn as $data{
  539.             if (strlen($array$data["column"] ]&& in_array($data["column"]$arrRejectRegistColumn)) {
  540.                 $arrRegist$data["column"] ] $array$data["column"] ];
  541.             }
  542.         }
  543.  
  544.         // 誕生日が入力されている場合
  545.         if (strlen($array["year"]{
  546.             $arrRegist["birth"$array["year"."/"$array["month"."/"$array["day"." 00:00:00";
  547.         }
  548.  
  549.         // パスワードの暗号化
  550.         $arrRegist["password"sha1($arrRegist["password"":" AUTH_MAGIC);
  551.  
  552.         // 仮会員登録の場合
  553.         if($confirm_flg == true{
  554.             // 重複しない会員登録キーを発行する。
  555.             $count 1;
  556.             while ($count != 0{
  557.                 $uniqid SC_Utils_Ex::sfGetUniqRandomId("t");
  558.                 $count $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?"array($uniqid));
  559.             }
  560.             switch($array["mailmaga_flg"]{
  561.                 case 1:
  562.                     $arrRegist["mailmaga_flg"4;
  563.                     break;
  564.                 case 2:
  565.                     $arrRegist["mailmaga_flg"5;
  566.                     break;
  567.                 default:
  568.                     $arrRegist["mailmaga_flg"6;
  569.                     break;
  570.             }
  571.  
  572.             $arrRegist["status""1";                // 仮会員
  573.         else {
  574.             // 重複しない会員登録キーを発行する。
  575.             $count 1;
  576.             while ($count != 0{
  577.                 $uniqid SC_Utils_Ex::sfGetUniqRandomId("r");
  578.                 $count $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?"array($uniqid));
  579.             }
  580.             $arrRegist["status""2";                // 本会員
  581.         }
  582.  
  583.         /*
  584.           secret_keyは、テーブルで重複許可されていない場合があるので、
  585.           本会員登録では利用されないがセットしておく。
  586.         */
  587.         $arrRegist["secret_key"$uniqid;        // 会員登録キー
  588.         $arrRegist["create_date""now()";     // 作成日
  589.         $arrRegist["update_date""now()";     // 更新日
  590.         $arrRegist["first_buy_date""";         // 最初の購入日
  591.         $arrRegist["point"$this->CONF["welcome_point"]// 入会時ポイント
  592.  
  593.         if ($isMobile{
  594.             // 携帯メールアドレス
  595.             $arrRegist['email_mobile'$arrRegist['email'];
  596.             //PHONE_IDを取り出す
  597.             $phoneId SC_MobileUserAgent::getId();
  598.             $arrRegist['mobile_phone_id'=  $phoneId;
  599.         }
  600.  
  601.         //-- 仮登録実行
  602.         $objConn->query("BEGIN");
  603.  
  604.         $objQuery new SC_Query();
  605.         $objQuery->insert("dtb_customer"$arrRegist);
  606.  
  607.  
  608.     /* メルマガ会員機能は現在停止中 2007/03/07
  609.  
  610.  
  611.         //-- 非会員でメルマガ登録しているかの判定
  612.         $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
  613.         $mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
  614.  
  615.         //-- メルマガ仮登録実行
  616.         $arrRegistMail["email"] = $arrRegist["email"];
  617.         if ($array["mailmaga_flg"] == 1) {
  618.             $arrRegistMail["mailmaga_flg"] = 4;
  619.         } elseif ($array["mailmaga_flg"] == 2) {
  620.             $arrRegistMail["mailmaga_flg"] = 5;
  621.         } else {
  622.             $arrRegistMail["mailmaga_flg"] = 6;
  623.         }
  624.         $arrRegistMail["update_date"] = "now()";
  625.  
  626.         // 非会員でメルマガ登録している場合
  627.         if ($mailResult == 1) {
  628.             $objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");
  629.         } else {                // 新規登録の場合
  630.             $arrRegistMail["create_date"] = "now()";
  631.             $objQuery->insert("dtb_customer_mail", $arrRegistMail);
  632.         }
  633.     */
  634.         $objConn->query("COMMIT");
  635.  
  636.         return $uniqid;
  637.     }
  638.  
  639.     //---- 取得文字列の変換
  640.     function lfConvertParam($array$arrRegistColumn{
  641.         /*
  642.          *    文字列の変換
  643.          *    K :  「半角(ハンカク)片仮名」を「全角片仮名」に変換
  644.          *    C :  「全角ひら仮名」を「全角かた仮名」に変換
  645.          *    V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
  646.          *    n :  「全角」数字を「半角(ハンカク)」に変換
  647.          *  a :  全角英数字を半角英数字に変換する
  648.          */
  649.         // カラム名とコンバート情報
  650.         foreach ($arrRegistColumn as $data{
  651.             $arrConvList$data["column"] ] $data["convert"];
  652.         }
  653.         // 文字変換
  654.         foreach ($arrConvList as $key => $val{
  655.             // POSTされてきた値のみ変換する。
  656.             if(isset($array[$key]&& strlen($array[$key]0{
  657.                 $array[$keymb_convert_kana($array[$key,$val);
  658.             }
  659.         }
  660.         return $array;
  661.     }
  662.  
  663.     //---- 入力エラーチェック
  664.     function lfErrorCheck($array{
  665.  
  666.         $objErr new SC_CheckError($array);
  667.  
  668.         $objErr->doFunc(array("お名前(姓)"'name01'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  669.         $objErr->doFunc(array("お名前(名)"'name02'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" "MAX_LENGTH_CHECK"));
  670.         $objErr->doFunc(array("フリガナ(セイ)"'kana01'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  671.         $objErr->doFunc(array("フリガナ(メイ)"'kana02'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  672.         $objErr->doFunc(array("郵便番号1""zip01"ZIP01_LEN ,array("EXIST_CHECK""SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  673.         $objErr->doFunc(array("郵便番号2""zip02"ZIP02_LEN ,array("EXIST_CHECK""SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  674.         $objErr->doFunc(array("郵便番号""zip01""zip02")array("ALL_EXIST_CHECK"));
  675.         $objErr->doFunc(array("都道府県"'pref')array("SELECT_CHECK","NUM_CHECK"));
  676.         $objErr->doFunc(array("ご住所1""addr01"MTEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  677.         $objErr->doFunc(array("ご住所2""addr02"MTEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  678.         $objErr->doFunc(array('メールアドレス'"email"MTEXT_LEN,array("NO_SPTAB""EXIST_CHECK""EMAIL_CHECK""SPTAB_CHECK" ,"EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK"));
  679.         $objErr->doFunc(array('メールアドレス(確認)'"email02"MTEXT_LEN,array("NO_SPTAB""EXIST_CHECK""EMAIL_CHECK","SPTAB_CHECK" "EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK"));
  680.         $objErr->doFunc(array('メールアドレス''メールアドレス(確認)'"email""email02",array("EQUAL_CHECK"));
  681.  
  682.         //現会員の判定 → 現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
  683.         if (strlen($array["email"]0{
  684.             $array["email"strtolower($array["email"]);
  685.             $objQuery new SC_Query();
  686.             $arrRet $objQuery->select("email, update_date, del_flg""dtb_customer","email = ? ORDER BY del_flg"array($array["email"]));
  687.  
  688.             if(count($arrRet0{
  689.                 if($arrRet[0]['del_flg'!= '1'{
  690.                     // 会員である場合
  691.                     if (!isset($objErr->arrErr['email'])) $objErr->arrErr['email'"";
  692.                     $objErr->arrErr["email".= "※ すでに会員登録で使用されているメールアドレスです。<br />";
  693.                 else {
  694.                     // 退会した会員である場合
  695.                     $leave_time SC_Utils_Ex::sfDBDatetoTime($arrRet[0]['update_date']);
  696.                     $now_time time();
  697.                     $pass_time $now_time $leave_time;
  698.                     // 退会から何時間-経過しているか判定する。
  699.                     $limit_time ENTRY_LIMIT_HOUR 3600;
  700.                     if($pass_time $limit_time{
  701.                         if (!isset($objErr->arrErr['email'])) $objErr->arrErr['email'"";
  702.                         $objErr->arrErr["email".= "※ 退会から一定期間の間は、同じメールアドレスを使用することはできません。<br />";
  703.                     }
  704.                 }
  705.             }
  706.         }
  707.  
  708.         $objErr->doFunc(array("お電話番号1"'tel01')array("EXIST_CHECK","SPTAB_CHECK" ));
  709.         $objErr->doFunc(array("お電話番号2"'tel02')array("EXIST_CHECK","SPTAB_CHECK" ));
  710.         $objErr->doFunc(array("お電話番号3"'tel03')array("EXIST_CHECK","SPTAB_CHECK" ));
  711.         $objErr->doFunc(array("お電話番号""tel01""tel02""tel03",TEL_ITEM_LEN,array("TEL_CHECK"));
  712.         $objErr->doFunc(array("FAX番号1"'fax01')array("SPTAB_CHECK"));
  713.         $objErr->doFunc(array("FAX番号2"'fax02')array("SPTAB_CHECK"));
  714.         $objErr->doFunc(array("FAX番号3"'fax03')array("SPTAB_CHECK"));
  715.         $objErr->doFunc(array("FAX番号""fax01""fax02""fax03"TEL_ITEM_LEN,array("TEL_CHECK"));
  716.         $objErr->doFunc(array("ご性別""sex",array("SELECT_CHECK""NUM_CHECK"));
  717.         $objErr->doFunc(array("パスワード"'password'PASSWORD_LEN1PASSWORD_LEN2)array("EXIST_CHECK""SPTAB_CHECK" ,"ALNUM_CHECK""NUM_RANGE_CHECK"));
  718.         $objErr->doFunc(array("パスワード(確認)"'password02'PASSWORD_LEN1PASSWORD_LEN2)array("EXIST_CHECK""SPTAB_CHECK" ,"ALNUM_CHECK""NUM_RANGE_CHECK"));
  719.         $objErr->doFunc(array('パスワード''パスワード(確認)'"password""password02",array("EQUAL_CHECK"));
  720.         $objErr->doFunc(array("パスワードを忘れたときのヒント 質問""reminder",array("SELECT_CHECK""NUM_CHECK"));
  721.         $objErr->doFunc(array("パスワードを忘れたときのヒント 答え""reminder_answer"STEXT_LEN,array("EXIST_CHECK","SPTAB_CHECK" "MAX_LENGTH_CHECK"));
  722.         $objErr->doFunc(array("メールマガジン""mailmaga_flg",array("SELECT_CHECK""NUM_CHECK"));
  723.  
  724.         $objErr->doFunc(array("生年月日""year""month""day")array("CHECK_BIRTHDAY"));
  725.         $objErr->doFunc(array("メールマガジン"'mailmaga_flg')array("SELECT_CHECK"));
  726.         return $objErr->arrErr;
  727.     }
  728.  
  729.     //確認ページ用パスワード表示用
  730.  
  731.     function lfPassLen($passlen){
  732.         $ret "";
  733.         for ($i=0;$i<$passlen;true){
  734.         $ret.="*";
  735.         $i++;
  736.         }
  737.         return $ret;
  738.     }
  739.  
  740.     // }}}
  741.     // {{{ mobile functions
  742.  
  743.     // 郵便番号から住所の取得
  744.     function lfGetAddress($zipcode{
  745.  
  746.         $conn new SC_DBconn(ZIP_DSN);
  747.  
  748.         // 郵便番号検索文作成
  749.         $zipcode mb_convert_kana($zipcode ,"n");
  750.         $sqlse "SELECT state, city, town FROM mtb_zip WHERE zipcode = ?";
  751.  
  752.         $data_list $conn->getAll($sqlsearray($zipcode));
  753.  
  754.         // インデックスと値を反転させる。
  755.         $arrREV_PREF array_flip($this->arrPref);
  756.  
  757.         /*
  758.          総務省からダウンロードしたデータをそのままインポートすると
  759.          以下のような文字列が入っているので    対策する。
  760.          ・(1・19丁目)
  761.          ・以下に掲載がない場合
  762.         */
  763.         $town =  $data_list[0]['town'];
  764.         $town ereg_replace("(.*)$","",$town);
  765.         $town ereg_replace("以下に掲載がない場合","",$town);
  766.         $data_list[0]['town'$town;
  767.         $data_list[0]['state'$arrREV_PREF[$data_list[0]['state']];
  768.  
  769.         return $data_list;
  770.     }
  771.  
  772.     //---- 入力エラーチェック
  773.     function lfErrorCheck1($array{
  774.  
  775.         $objErr new SC_CheckError($array);
  776.         $objDb new SC_Helper_DB_Ex();
  777.  
  778.         $objErr->doFunc(array("お名前(姓)"'name01'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  779.         $objErr->doFunc(array("お名前(名)"'name02'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" "MAX_LENGTH_CHECK"));
  780.         $objErr->doFunc(array("お名前(カナ/姓)"'kana01'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  781.         $objErr->doFunc(array("お名前(カナ/名)"'kana02'STEXT_LEN)array("EXIST_CHECK""NO_SPTAB""SPTAB_CHECK" ,"MAX_LENGTH_CHECK""KANA_CHECK"));
  782.         $objErr->doFunc(array('メールアドレス'"email"MTEXT_LEN,array("NO_SPTAB""EXIST_CHECK""EMAIL_CHECK""SPTAB_CHECK" ,"EMAIL_CHAR_CHECK""MAX_LENGTH_CHECK""MOBILE_EMAIL_CHECK"));
  783.  
  784.         //現会員の判定 → 現会員もしくは仮登録中は、メアド一意が前提になってるので同じメアドで登録不可
  785.         if (strlen($array["email"]0{
  786.             $array['email'strtolower($array['email']);
  787.             $objQuery new SC_Query();
  788.             $arrRet $objQuery->select("email, update_date, del_flg""dtb_customer","email = ? OR email_mobile = ? ORDER BY del_flg"array($array["email"]$array["email"]));
  789.  
  790.             if(count($arrRet0{
  791.                 if($arrRet[0]['del_flg'!= '1'{
  792.                     // 会員である場合
  793.                     $objErr->arrErr["email".= "※ すでに会員登録で使用されているメールアドレスです。<br />";
  794.                 else {
  795.                     // 退会した会員である場合
  796.                     $leave_time SC_Utils_Ex::sfDBDatetoTime($arrRet[0]['update_date']);
  797.                     $now_time time();
  798.                     $pass_time $now_time $leave_time;
  799.                     // 退会から何時間-経過しているか判定する。
  800.                     $limit_time ENTRY_LIMIT_HOUR 3600;
  801.                     if($pass_time $limit_time{
  802.                         $objErr->arrErr["email".= "※ 退会から一定期間の間は、同じメールアドレスを使用することはできません。<br />";
  803.                     }
  804.                 }
  805.             }
  806.         }
  807.  
  808.         $objErr->doFunc(array("パスワード"'password'PASSWORD_LEN1PASSWORD_LEN2)array("EXIST_CHECK""SPTAB_CHECK" ,"ALNUM_CHECK""NUM_RANGE_CHECK"));
  809.         $objErr->doFunc(array("パスワード確認用の質問""reminder",array("SELECT_CHECK""NUM_CHECK"));
  810.         $objErr->doFunc(array("パスワード確認用の質問の答え""reminder_answer"STEXT_LEN,array("EXIST_CHECK","SPTAB_CHECK" "MAX_LENGTH_CHECK"));
  811.  
  812.         return $objErr->arrErr;
  813.     }
  814.  
  815.     //---- 入力エラーチェック
  816.     function lfErrorCheck2($array{
  817.         $objErr new SC_CheckError($array);
  818.         $objErr->doFunc(array("郵便番号1""zip01"ZIP01_LEN ,array("EXIST_CHECK""SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  819.         $objErr->doFunc(array("郵便番号2""zip02"ZIP02_LEN ,array("EXIST_CHECK""SPTAB_CHECK" ,"NUM_CHECK""NUM_COUNT_CHECK"));
  820.         $objErr->doFunc(array("郵便番号""zip01""zip02")array("ALL_EXIST_CHECK"));
  821.  
  822.         $objErr->doFunc(array("性別""sex",array("SELECT_CHECK""NUM_CHECK"));
  823.         $objErr->doFunc(array("生年月日""year""month""day")array("CHECK_BIRTHDAY"));
  824.  
  825.         return $objErr->arrErr;
  826.     }
  827.  
  828.     //---- 入力エラーチェック
  829.     function lfErrorCheck3($array{
  830.         $objErr new SC_CheckError($array);
  831.  
  832.         $objErr->doFunc(array("都道府県"'pref')array("SELECT_CHECK","NUM_CHECK"));
  833.         $objErr->doFunc(array("市区町村""addr01"MTEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  834.         $objErr->doFunc(array("番地""addr02"MTEXT_LEN)array("EXIST_CHECK","SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
  835.         $objErr->doFunc(array("電話番号1"'tel01')array("EXIST_CHECK","SPTAB_CHECK" ));
  836.         $objErr->doFunc(array("電話番号2"'tel02')array("EXIST_CHECK","SPTAB_CHECK" ));
  837.         $objErr->doFunc(array("電話番号3"'tel03')array("EXIST_CHECK","SPTAB_CHECK" ));
  838.         $objErr->doFunc(array("電話番号""tel01""tel02""tel03",TEL_ITEM_LEN,array("TEL_CHECK"));
  839.  
  840.         return $objErr->arrErr;
  841.     }
  842.  
  843. }
  844. ?>

Documentation generated on Tue, 28 Apr 2009 18:12:07 +0900 by phpDocumentor 1.4.2