/**
  * 重複しない会員登録キーを発行する。
  *
  * @access public
  * @return string 会員登録キーの文字列
  */
 public function sfGetUniqSecretKey()
 {
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     do {
         $uniqid = SC_Utils_Ex::sfGetUniqRandomId('r');
         $exists = $objQuery->exists('dtb_customer', 'secret_key = ?', array($uniqid));
     } while ($exists);
     return $uniqid;
 }
 /**
  * TODO
  * @deprecated 未使用?
  */
 function lfRegistDataMobile($array, $arrRegistColumn, $arrRejectRegistColumn)
 {
     // 仮登録
     foreach ($arrRegistColumn as $data) {
         if (strlen($array[$data["column"]]) > 0 && !in_array($data["column"], $arrRejectRegistColumn)) {
             $arrRegist[$data["column"]] = $array[$data["column"]];
         }
     }
     // 誕生日が入力されている場合
     if (strlen($array["year"]) > 0) {
         $arrRegist["birth"] = $array["year"] . "/" . $array["month"] . "/" . $array["day"] . " 00:00:00";
     }
     // パスワードの暗号化
     $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
     $count = 1;
     while ($count != 0) {
         $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t");
         $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
     }
     $arrRegist["secret_key"] = $uniqid;
     // 仮登録ID発行
     $arrRegist["create_date"] = "now()";
     // 作成日
     $arrRegist["update_date"] = "now()";
     // 更新日
     $arrRegist["first_buy_date"] = "";
     // 最初の購入日
     //-- 仮登録実行
     $this->objQuery->insert("dtb_customer", $arrRegist);
     return $uniqid;
 }
 public function setUniqId()
 {
     // 予測されないようにランダム文字列を付与する。
     $_SESSION['site']['uniqid'] = SC_Utils_Ex::sfGetUniqRandomId();
 }
 /**
  * 登録処理
  *
  * @param  array $objFormParam フォームパラメータークラス
  * @return array エラー配列
  */
 public function lfRegistData(&$objFormParam)
 {
     // 登録用データ取得
     $arrData = $objFormParam->getDbArray();
     // 足りないものを作る
     if (!SC_Utils_Ex::isBlank($objFormParam->getValue('year'))) {
         $arrData['birth'] = $objFormParam->getValue('year') . '/' . $objFormParam->getValue('month') . '/' . $objFormParam->getValue('day') . ' 00:00:00';
     }
     if (!is_numeric($arrData['customer_id'])) {
         $arrData['secret_key'] = SC_Utils_Ex::sfGetUniqRandomId('r');
     } else {
         $arrOldCustomerData = SC_Helper_Customer_Ex::sfGetCustomerData($arrData['customer_id']);
         if ($arrOldCustomerData['status'] != $arrData['status']) {
             $arrData['secret_key'] = SC_Utils_Ex::sfGetUniqRandomId('r');
         }
     }
     return SC_Helper_Customer_Ex::sfEditCustomerData($arrData, $arrData['customer_id']);
 }
 function lfRegistPreCustomer($arrData, $arrInfo)
 {
     // 購入時の会員登録
     $sqlval['name01'] = $arrData['order_name01'];
     $sqlval['name02'] = $arrData['order_name02'];
     $sqlval['kana01'] = $arrData['order_kana01'];
     $sqlval['kana02'] = $arrData['order_kana02'];
     $sqlval['zip01'] = $arrData['order_zip01'];
     $sqlval['zip02'] = $arrData['order_zip02'];
     $sqlval['pref'] = $arrData['order_pref'];
     $sqlval['addr01'] = $arrData['order_addr01'];
     $sqlval['addr02'] = $arrData['order_addr02'];
     $sqlval['email'] = $arrData['order_email'];
     $sqlval['tel01'] = $arrData['order_tel01'];
     $sqlval['tel02'] = $arrData['order_tel02'];
     $sqlval['tel03'] = $arrData['order_tel03'];
     $sqlval['fax01'] = $arrData['order_fax01'];
     $sqlval['fax02'] = $arrData['order_fax02'];
     $sqlval['fax03'] = $arrData['order_fax03'];
     $sqlval['sex'] = $arrData['order_sex'];
     $sqlval['password'] = $arrData['password'];
     $sqlval['reminder'] = $arrData['reminder'];
     $sqlval['reminder_answer'] = $arrData['reminder_answer'];
     // メルマガ配信用フラグの判定
     switch ($arrData['mail_flag']) {
         case '1':
             // HTMLメール
             $mail_flag = 4;
             break;
         case '2':
             // TEXTメール
             $mail_flag = 5;
             break;
         case '3':
             // 希望なし
             $mail_flag = 6;
             break;
         default:
             $mail_flag = 6;
             break;
     }
     // メルマガフラグ
     $sqlval['mailmaga_flg'] = $mail_flag;
     // 会員仮登録
     $sqlval['status'] = 1;
     // URL判定用キー
     $sqlval['secret_key'] = SC_Utils_Ex::sfGetUniqRandomId("t");
     $objQuery = new SC_Query();
     $sqlval['create_date'] = "now()";
     $sqlval['update_date'] = "now()";
     $objQuery->insert("dtb_customer", $sqlval);
     // 顧客IDの取得
     $arrRet = $objQuery->select("customer_id", "dtb_customer", "secret_key = ?", array($sqlval['secret_key']));
     $customer_id = $arrRet[0]['customer_id'];
     // 仮登録完了メール送信
     $objMailPage = $this;
     $objMailPage->to_name01 = $arrData['order_name01'];
     $objMailPage->to_name02 = $arrData['order_name02'];
     $objMailPage->CONF = $arrInfo;
     $objMailPage->uniqid = $sqlval['secret_key'];
     $objMailView = new SC_SiteView();
     $objMailView->assignobj($objMailPage);
     $body = $objMailView->fetch("mail_templates/customer_mail.tpl");
     $mailHelper = new SC_Helper_Mail_Ex();
     $objMail = new SC_SendMail();
     $objMail->setItem('', $mailHelper->sfMakeSubject($objQuery, $objMailView, $objMailPage, "会員登録のご確認"), $body, $arrInfo['email03'], $arrInfo['shop_name'], $arrInfo["email03"], $arrInfo["email04"], $arrInfo["email04"], $arrInfo["email01"]);
     // 宛先の設定
     $name = $arrData['order_name01'] . $arrData['order_name02'] . " 様";
     $objMail->setTo($arrData['order_email'], $name);
     $objMail->sendMail();
     return $customer_id;
 }
Beispiel #6
0
 /** ユニークIDのセット **/
 function setUniqId()
 {
     // 予測されないようにランダム文字列を付与する。
     $this->SetSession('uniqid', SC_Utils_Ex::sfGetUniqRandomId());
 }
 function lfGetSecretKey($email, &$objConn)
 {
     $sql = "SELECT secret_key FROM dtb_customer_mail WHERE email = ?";
     $uniqid = $objConn->getOne($sql, array($email));
     if ($uniqid == '') {
         $count = 1;
         while ($count != 0) {
             $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t");
             $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer_mail WHERE secret_key = ?", array($uniqid));
         }
         $objQuery = new SC_Query();
         $objQuery->update("dtb_customer_mail", array('secret_key' => $uniqid), "email = " . SC_Utils_Ex::sfQuoteSmart($email));
     }
     return $uniqid;
 }
 /**
  *
  * 新規ユーザーの作成
  *
  * @param SC_Customer $objCustomer
  * @param string $openid
  */
 function doNewUser(SC_Customer $objCustomer, $openid = "")
 {
     $customer = array("name01" => "英雄", "name02" => "太郎", "kana01" => "エイユウ", "kana02" => "タロウ", "zip01" => $this->arrSiteInfo["zip01"], "zip02" => $this->arrSiteInfo["zip02"], "pref" => $this->arrSiteInfo["pref"], "addr01" => $this->arrSiteInfo["addr01"], "addr02" => $this->arrSiteInfo["addr02"], "tel01" => $this->arrSiteInfo["tel01"], "tel02" => $this->arrSiteInfo["tel02"], "tel03" => $this->arrSiteInfo["tel03"], "sex" => 0, "password" => DEFAULT_PASSWORD, "reminder" => 1, "reminder_answer" => DEFAULT_PASSWORD, "mailmaga_flg" => "3", "au_open_id" => $openid);
     $customer["email"] = SC_Utils_Ex::sfGetUniqRandomId("auone_", date("Ymd_")) . "@" . $_SERVER["SERVER_NAME"];
     $customer["secret_key"] = SC_Helper_Customer_Ex::sfGetUniqSecretKey();
     $customer_id = SC_Helper_Customer_Ex::sfEditCustomerData($customer);
     $customer["customer_id"] = $customer_id;
     $this->setLoginInfo($customer);
 }
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     // 認証可否の判定
     $objSess = new SC_Session();
     SC_Utils_Ex::sfIsSuccess($objSess);
     $this->objQuery = new SC_Query();
     $this->objConn = new SC_DBConn();
     $objView = new SC_AdminView();
     $objDb = new SC_Helper_DB_Ex();
     $objDate = new SC_Date(1901);
     $this->arrYear = $objDate->getYear();
     // 日付プルダウン設定
     $this->arrMonth = $objDate->getMonth();
     $this->arrDay = $objDate->getDay();
     //---- 登録用カラム配列
     $arrRegistColumn = array(array("column" => "name01", "convert" => "aKV"), array("column" => "name02", "convert" => "aKV"), array("column" => "kana01", "convert" => "CKV"), array("column" => "kana02", "convert" => "CKV"), array("column" => "zip01", "convert" => "n"), array("column" => "zip02", "convert" => "n"), array("column" => "pref", "convert" => "n"), array("column" => "addr01", "convert" => "aKV"), array("column" => "addr02", "convert" => "aKV"), array("column" => "email", "convert" => "a"), array("column" => "email_mobile", "convert" => "a"), array("column" => "tel01", "convert" => "n"), array("column" => "tel02", "convert" => "n"), array("column" => "tel03", "convert" => "n"), array("column" => "fax01", "convert" => "n"), array("column" => "fax02", "convert" => "n"), array("column" => "fax03", "convert" => "n"), array("column" => "sex", "convert" => "n"), array("column" => "job", "convert" => "n"), array("column" => "birth", "convert" => "n"), array("column" => "password", "convert" => "a"), array("column" => "reminder", "convert" => "n"), array("column" => "reminder_answer", "convert" => "aKV"), array("column" => "mailmaga_flg", "convert" => "n"), array("column" => "note", "convert" => "aKV"), array("column" => "point", "convert" => "n"), array("column" => "status", "convert" => "n"));
     //---- 登録除外用カラム配列
     $arrRejectRegistColumn = array("year", "month", "day");
     // 検索条件を保持
     if ($_POST['mode'] == "edit_search") {
         $arrSearch = $_POST;
     } else {
         $arrSearch = $_POST['search_data'];
     }
     if (is_array($arrSearch)) {
         foreach ($arrSearch as $key => $val) {
             $arrSearchData[$key] = $val;
         }
     }
     $this->arrSearchData = $arrSearchData;
     //---- 顧客編集情報取得
     if (($_POST["mode"] == "edit" || $_POST["mode"] == "edit_search") && is_numeric($_POST["edit_customer_id"])) {
         //-- 顧客データ取得
         $sql = "SELECT * FROM dtb_customer WHERE del_flg = 0 AND customer_id = ?";
         $result = $this->objConn->getAll($sql, array($_POST["edit_customer_id"]));
         $this->list_data = $result[0];
         $birth = split(" ", $this->list_data["birth"]);
         $birth = split("-", $birth[0]);
         $this->list_data["year"] = $birth[0];
         $this->list_data["month"] = isset($birth[1]) ? $birth[1] : "";
         $this->list_data["day"] = isset($birth[2]) ? $birth[2] : "";
         $this->list_data["password"] = DEFAULT_PASSWORD;
         //DB登録のメールアドレスを渡す
         $this->tpl_edit_email = $result[0]['email'];
         //購入履歴情報の取得
         $this->arrPurchaseHistory = $this->lfPurchaseHistory($_POST['edit_customer_id']);
         // 支払い方法の取得
         $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
     }
     //---- 顧客情報編集
     if ($_POST["mode"] != "edit" && $_POST["mode"] != "edit_search" && is_numeric($_POST["customer_id"])) {
         //-- POSTデータの引き継ぎ
         $this->arrForm = $_POST;
         $this->arrForm['email'] = strtolower($this->arrForm['email']);
         // emailはすべて小文字で処理
         //-- 入力データの変換
         $this->arrForm = $this->lfConvertParam($this->arrForm, $arrRegistColumn);
         //-- 入力チェック
         $this->arrErr = $this->lfErrorCheck($this->arrForm);
         //-- 入力エラー発生 or リターン時
         if ($this->arrErr || $_POST["mode"] == "return") {
             foreach ($this->arrForm as $key => $val) {
                 $this->list_data[$key] = $val;
             }
             //購入履歴情報の取得
             $this->arrPurchaseHistory = $this->lfPurchaseHistory($_POST['customer_id']);
             // 支払い方法の取得
             $this->arrPayment = $objDb->sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
         } else {
             //-- 確認
             if ($_POST["mode"] == "confirm") {
                 $this->tpl_mainpage = 'customer/edit_confirm.tpl';
                 $passlen = strlen($this->arrForm['password']);
                 $this->passlen = $this->lfPassLen($passlen);
             }
             //-- 編集
             if ($_POST["mode"] == "complete") {
                 $this->tpl_mainpage = 'customer/edit_complete.tpl';
                 // 現在の会員情報を取得する
                 $arrCusSts = $this->objQuery->getOne("SELECT status FROM dtb_customer WHERE customer_id = ?", array($_POST["customer_id"]));
                 // 会員情報が変更されている場合にはシークレット№も更新する。
                 if ($arrCusSts != $_POST['status']) {
                     $secret = SC_Utils_Ex::sfGetUniqRandomId("r");
                     $this->arrForm['secret_key'] = $secret;
                     array_push($arrRegistColumn, array('column' => 'secret_key', 'convert' => 'n'));
                 }
                 //-- 編集登録
                 $objDb->sfEditCustomerData($this->arrForm, $arrRegistColumn);
             }
         }
     }
     //---- ページ表示
     $objView->assignobj($this);
     $objView->display(MAIN_FRAME);
 }
 function lfRegistData($array, $arrRegistColumn, $arrRejectRegistColumn)
 {
     $objConn = new SC_DbConn();
     // 仮登録
     foreach ($arrRegistColumn as $data) {
         if (strlen($array[$data["column"]]) > 0 && !in_array($data["column"], $arrRejectRegistColumn)) {
             $arrRegist[$data["column"]] = $array[$data["column"]];
         }
     }
     // 誕生日が入力されている場合
     if (strlen($array["year"]) > 0) {
         $arrRegist["birth"] = $array["year"] . "/" . $array["month"] . "/" . $array["day"] . " 00:00:00";
     }
     // パスワードの暗号化
     $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
     $count = 1;
     while ($count != 0) {
         $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t");
         $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
     }
     $arrRegist["secret_key"] = $uniqid;
     // 仮登録ID発行
     $arrRegist["create_date"] = "now()";
     // 作成日
     $arrRegist["update_date"] = "now()";
     // 更新日
     $arrRegist["first_buy_date"] = "";
     // 最初の購入日
     //-- 仮登録実行
     $objConn->query("BEGIN");
     $objQuery = new SC_Query();
     $objQuery->insert("dtb_customer", $arrRegist);
     /* メルマガ会員機能は現在停止中 2007/03/07
     
             //-- 非会員でメルマガ登録しているかの判定
             $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
             $mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
     
             //-- メルマガ仮登録実行
             $arrRegistMail["email"] = $arrRegist["email"];
             if ($array["mailmaga_flg"] == 1) {
     		$arrRegistMail["mailmaga_flg"] = 4;
             } elseif ($array["mailmaga_flg"] == 2) {
     		$arrRegistMail["mailmaga_flg"] = 5;
             } else {
     		$arrRegistMail["mailmaga_flg"] = 6;
             }
             $arrRegistMail["update_date"] = "now()";
     
             // 非会員でメルマガ登録している場合
             if ($mailResult == 1) {
     		$objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");
             } else {				// 新規登録の場合
     		$arrRegistMail["create_date"] = "now()";
     		$objQuery->insert("dtb_customer_mail", $arrRegistMail);
             }
             */
     $objConn->query("COMMIT");
     return $uniqid;
 }
Beispiel #11
0
 function lfRegistData($array)
 {
     $objQuery = new SC_Query();
     $this->arrInfo;
     do {
         $secret = SC_Utils_Ex::sfGetUniqRandomId("r");
     } while (($result = $objQuery->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($secret))) != 0);
     $sql = "SELECT email FROM dtb_customer WHERE secret_key = ? AND status = 1";
     $email = $objQuery->getOne($sql, array($array["id"]));
     $objQuery->begin();
     $arrRegist["secret_key"] = $secret;
     // 本登録ID発行
     $arrRegist["status"] = 2;
     $arrRegist["update_date"] = "NOW()";
     $where = "secret_key = ? AND status = 1";
     $arrRet = $objQuery->select("point", "dtb_customer", $where, array($array["id"]));
     // 会員登録時の加算ポイント(購入時会員登録の場合は、ポイント加算)
     $arrRegist['point'] = $arrRet[0]['point'] + $arrInfo['welcome_point'];
     $objQuery->update("dtb_customer", $arrRegist, $where, array($array["id"]));
     /* 購入時の自動会員登録は行わないためDEL
        // 購入時登録の場合、その回の購入を会員購入とみなす。
        // 会員情報の読み込み
        $where1 = "secret_key = ? AND status = 2";
        $customer = $objQuery->select("*", "dtb_customer", $where1, array($secret));
        // 初回購入情報の読み込み
        $order_temp_id = $objQuery->get("dtb_order_temp", "order_temp_id");
        // 購入情報の更新
        if ($order_temp_id != null) {
            $arrCustomer['customer_id'] = $customer[0]['customer_id'];
            $where3 = "order_temp_id = ?";
            $objQuery->update("dtb_order_temp", $arrCustomer, $where3, array($order_temp_id));
            $objQuery->update("dtb_order", $arrCustomer, $where3, array($order_temp_id));
        }
        */
     $sql = "SELECT mailmaga_flg FROM dtb_customer WHERE email = ?";
     $result = $objQuery->getOne($sql, array($email));
     switch ($result) {
         // 仮HTML
         case '4':
             $arrRegistMail["mailmaga_flg"] = 1;
             break;
             // 仮TEXT
         // 仮TEXT
         case '5':
             $arrRegistMail["mailmaga_flg"] = 2;
             break;
             // 仮なし
         // 仮なし
         case '6':
             $arrRegistMail["mailmaga_flg"] = 3;
             break;
         default:
             $arrRegistMail["mailmaga_flg"] = $result;
             break;
     }
     $objQuery->update("dtb_customer", $arrRegistMail, "email = " . SC_Utils_Ex::sfQuoteSmart($email) . " AND del_flg = 0");
     $objQuery->commit();
     return $secret;
     // 本登録IDを返す
 }
Beispiel #12
0
 function lfRegistData($array, $arrRegistColumn, $arrRejectRegistColumn, $confirm_flg, $isMobile = false, $email_mobile = "")
 {
     $objConn = new SC_DbConn();
     // 登録データの生成
     foreach ($arrRegistColumn as $data) {
         if (strlen($array[$data["column"]]) > 0 && !in_array($data["column"], $arrRejectRegistColumn)) {
             $arrRegist[$data["column"]] = $array[$data["column"]];
         }
     }
     // 誕生日が入力されている場合
     if (strlen($array["year"]) > 0) {
         $arrRegist["birth"] = $array["year"] . "/" . $array["month"] . "/" . $array["day"] . " 00:00:00";
     }
     // パスワードの暗号化
     $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
     // 仮会員登録の場合
     if ($confirm_flg == true) {
         // 重複しない会員登録キーを発行する。
         $count = 1;
         while ($count != 0) {
             $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t");
             $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
         }
         switch ($array["mailmaga_flg"]) {
             case 1:
                 $arrRegist["mailmaga_flg"] = 4;
                 break;
             case 2:
                 $arrRegist["mailmaga_flg"] = 5;
                 break;
             default:
                 $arrRegist["mailmaga_flg"] = 6;
                 break;
         }
         $arrRegist["status"] = "1";
         // 仮会員
     } else {
         // 重複しない会員登録キーを発行する。
         $count = 1;
         while ($count != 0) {
             $uniqid = SC_Utils_Ex::sfGetUniqRandomId("r");
             $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
         }
         $arrRegist["status"] = "2";
         // 本会員
     }
     /*
       secret_keyは、テーブルで重複許可されていない場合があるので、
       本会員登録では利用されないがセットしておく。
     */
     $arrRegist["secret_key"] = $uniqid;
     // 会員登録キー
     $arrRegist["create_date"] = "now()";
     // 作成日
     $arrRegist["update_date"] = "now()";
     // 更新日
     $arrRegist["first_buy_date"] = "";
     // 最初の購入日
     $arrRegist["point"] = $this->CONF["welcome_point"];
     // 入会時ポイント
     if ($isMobile) {
         // 携帯メールアドレス
         $arrRegist['email_mobile'] = $arrRegist['email'];
         //PHONE_IDを取り出す
         $phoneId = SC_MobileUserAgent::getId();
         $arrRegist['mobile_phone_id'] = $phoneId;
     }
     //-- 仮登録実行
     $objConn->query("BEGIN");
     $objQuery = new SC_Query();
     $objQuery->insert("dtb_customer", $arrRegist);
     /* メルマガ会員機能は現在停止中 2007/03/07
     
     
             //-- 非会員でメルマガ登録しているかの判定
             $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
             $mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
     
             //-- メルマガ仮登録実行
             $arrRegistMail["email"] = $arrRegist["email"];
             if ($array["mailmaga_flg"] == 1) {
                 $arrRegistMail["mailmaga_flg"] = 4;
             } elseif ($array["mailmaga_flg"] == 2) {
                 $arrRegistMail["mailmaga_flg"] = 5;
             } else {
                 $arrRegistMail["mailmaga_flg"] = 6;
             }
             $arrRegistMail["update_date"] = "now()";
     
             // 非会員でメルマガ登録している場合
             if ($mailResult == 1) {
                 $objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");
             } else {				// 新規登録の場合
                 $arrRegistMail["create_date"] = "now()";
                 $objQuery->insert("dtb_customer_mail", $arrRegistMail);
             }
         */
     $objConn->query("COMMIT");
     return $uniqid;
 }