Changeset 11730 for branches/comu/data/class/SC_Customer.php
- Timestamp:
- 2007/03/11 06:27:25 (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
r11729 r11730 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.
