Changeset 11729 for branches/comu/data/class/SC_Customer.php
- Timestamp:
- 2007/03/10 21:35:02 (20 years ago)
- File:
-
- 1 edited
-
branches/comu/data/class/SC_Customer.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/comu/data/class/SC_Customer.php
r15 r11729 6 6 */ 7 7 8 /* [ ̾¾Î] SC_Customer9 * [ ³µÍ×] ²ñ°÷´ÉÍý¥¯¥é¥¹8 /* [名称] SC_Customer 9 * [概要] 会員管理クラス 10 10 */ 11 11 class SC_Customer { … … 13 13 var $conn; 14 14 var $email; 15 var $customer_data; // ²ñ°÷¾ðÊó15 var $customer_data; // 会員情報 16 16 17 17 function SC_Customer( $conn = '', $email = '', $pass = '' ) { 18 // ¥»¥Ã¥·¥ç¥ó³«»Ï19 /* startSession ¤«¤é°Üư 2005/11/04 ÃæÀî*/18 // セッション開始 19 /* startSessionから移動 2005/11/04 中川 */ 20 20 sfDomainSessionStart(); 21 21 22 // DB Àܳ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®22 // DB接続オブジェクト生成 23 23 $DB_class_name = "SC_DbConn"; 24 24 if ( is_object($conn)){ 25 25 if ( is_a($conn, $DB_class_name)){ 26 // $conn ¤¬$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤¢¤ë26 // $connが$DB_class_nameのインスタンスである 27 27 $this->conn = $conn; 28 28 } 29 29 } else { 30 30 if (class_exists($DB_class_name)){ 31 //$DB_class_name ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤¹¤ë31 //$DB_class_nameのインスタンスを作成する 32 32 $this->conn = new SC_DbConn(); 33 33 } … … 35 35 36 36 if ( is_object($this->conn) ) { 37 // Àµ¾ï¤ËDB¤ËÀܳ¤Ç¤¤ë37 // 正常にDBに接続できる 38 38 if ( $email ){ 39 // email ¤«¤é¸ÜµÒ¾ðÊó¤ò¼èÆÀ¤¹¤ë39 // emailから顧客情報を取得する 40 40 // $this->setCustomerDataFromEmail( $email ); 41 41 } 42 42 } else { 43 echo "DB Àܳ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀ¸À®¤Ë¼ºÇÔ¤·¤Æ¤¤¤Þ¤¹";43 echo "DB接続オブジェクトの生成に失敗しています"; 44 44 exit; 45 45 } … … 51 51 52 52 function getCustomerDataFromEmailPass( $pass, $email ) { 53 // ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß53 // 本登録された会員のみ 54 54 $sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND del_flg = 0 AND status = 2"; 55 55 $result = $this->conn->getAll($sql, array($email)); 56 56 $data = $result[0]; 57 57 58 // ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ì¤Ð¸ÜµÒ¾ðÊó¤òcustomer_data¤Ë¥»¥Ã¥È¤·¤Ætrue¤òÊÖ¤¹58 // パスワードが合っていれば顧客情報をcustomer_dataにセットしてtrueを返す 59 59 if ( sha1($pass . ":" . AUTH_MAGIC) == $data['password'] ){ 60 60 $this->customer_data = $data; … … 65 65 } 66 66 67 // ¥Ñ¥¹¥ï¡¼¥É¤ò³Îǧ¤»¤º¤Ë¥í¥°¥¤¥ó67 // パスワードを確認せずにログイン 68 68 function setLogin($email) { 69 // ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß69 // 本登録された会員のみ 70 70 $sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND del_flg = 0 AND status = 2"; 71 71 $result = $this->conn->getAll($sql, array($email)); … … 75 75 } 76 76 77 // ¥»¥Ã¥·¥ç¥ó¾ðÊó¤òºÇ¿·¤Î¾ðÊó¤Ë¹¹¿·¤¹¤ë77 // セッション情報を最新の情報に更新する 78 78 function updateSession() { 79 79 $sql = "SELECT * FROM dtb_customer WHERE customer_id = ? AND del_flg = 0"; … … 84 84 } 85 85 86 // ¥í¥°¥¤¥ó¾ðÊó¤ò¥»¥Ã¥·¥ç¥ó¤ËÅÐÏ¿¤·¡¢¥í¥°¤Ë½ñ¤¹þ¤à86 // ログイン情報をセッションに登録し、ログに書き込む 87 87 function startSession() { 88 88 sfDomainSessionStart(); 89 89 $_SESSION['customer'] = $this->customer_data; 90 // ¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÊݸ90 // セッション情報の保存 91 91 gfPrintLog("access : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH ); 92 92 } 93 93 94 // ¥í¥°¥¢¥¦¥È¡¡$_SESSION['customer']¤ò²òÊü¤·¡¢¥í¥°¤Ë½ñ¤¹þ¤à94 // ログアウト $_SESSION['customer']を解放し、ログに書き込む 95 95 function EndSession() { 96 // $_SESSION['customer'] ¤Î²òÊü96 // $_SESSION['customer']の解放 97 97 unset($_SESSION['customer']); 98 // ¥í¥°¤ËµÏ¿¤¹¤ë98 // ログに記録する 99 99 gfPrintLog("logout : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH ); 100 100 } 101 101 102 // ¥í¥°¥¤¥ó¤ËÀ®¸ù¤·¤Æ¤¤¤ë¤«È½Äꤹ¤ë¡£102 // ログインに成功しているか判定する。 103 103 function isLoginSuccess() { 104 // ¥í¥°¥¤¥ó»þ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÈDB¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬°ìÃפ·¤Æ¤¤¤ë¾ì¹ç104 // ログイン時のメールアドレスとDBのメールアドレスが一致している場合 105 105 if(sfIsInt($_SESSION['customer']['customer_id'])) { 106 106 $objQuery = new SC_Query(); … … 113 113 } 114 114 115 // ¥Ñ¥é¥á¡¼¥¿¤Î¼èÆÀ115 // パラメータの取得 116 116 function getValue($keyname) { 117 117 return $_SESSION['customer'][$keyname]; 118 118 } 119 119 120 // ¥Ñ¥é¥á¡¼¥¿¤Î¥»¥Ã¥È120 // パラメータのセット 121 121 function setValue($keyname, $val) { 122 122 $_SESSION['customer'][$keyname] = $val; 123 123 } 124 124 125 // ÃÂÀ¸Æü·î¤Ç¤¢¤ë¤«¤É¤¦¤«¤ÎȽÄê125 // 誕生日月であるかどうかの判定 126 126 function isBirthMonth() { 127 127 $arrRet = split("[- :/]", $_SESSION['customer']['birth']);
Note: See TracChangeset
for help on using the changeset viewer.
