Changeset 16088 for branches/rel
- Timestamp:
- 2007/09/27 15:49:39 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rel/data/class/SC_Customer.php
r15306 r16088 11 11 class SC_Customer { 12 12 13 var $conn; 14 var $email; 15 var $customer_data; // ²ñ°÷¾ðÊó 16 17 function SC_Customer( $conn = '', $email = '', $pass = '' ) { 18 // ¥»¥Ã¥·¥ç¥ó³«»Ï 19 /* startSession¤«¤é°ÜÆ° 2005/11/04 ÃæÀî */ 20 sfDomainSessionStart(); 21 22 // DBÀܳ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À® 23 $DB_class_name = "SC_DbConn"; 24 if ( is_object($conn)){ 25 if ( is_a($conn, $DB_class_name)){ 26 // $conn¤¬$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤¢¤ë 27 $this->conn = $conn; 28 } 29 } else { 30 if (class_exists($DB_class_name)){ 31 //$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤¹¤ë 32 $this->conn = new SC_DbConn(); 33 } 34 } 35 36 if ( is_object($this->conn) ) { 37 // Àµ¾ï¤ËDB¤ËÀܳ¤Ç¤¤ë 38 if ( $email ){ 39 // email¤«¤é¸ÜµÒ¾ðÊó¤ò¼èÆÀ¤¹¤ë 40 // $this->setCustomerDataFromEmail( $email ); 41 } 42 } else { 43 echo "DBÀܳ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀ¸À®¤Ë¼ºÇÔ¤·¤Æ¤¤¤Þ¤¹"; 44 exit; 45 } 46 47 if ( strlen($email) > 0 && strlen($pass) > 0 ){ 48 $this->getCustomerDataFromEmailPass($pass, $email); 49 } 50 } 51 52 function getCustomerDataFromEmailPass( $pass, $email, $mobile = false ) { 53 $sql_mobile = $mobile ? ' OR email_mobile ILIKE ?' : ''; 54 $arrValues = array($email); 55 if ($mobile) { 56 $arrValues[] = $email; 57 } 58 // ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß 59 $sql = "SELECT * FROM dtb_customer WHERE (email ILIKE ?" . $sql_mobile . ") AND del_flg = 0 AND status = 2"; 60 $result = $this->conn->getAll($sql, $arrValues); 61 $data = $result[0]; 62 63 // ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ì¤Ð¸ÜµÒ¾ðÊó¤òcustomer_data¤Ë¥»¥Ã¥È¤·¤Ætrue¤òÊÖ¤¹ 64 if ( sha1($pass . ":" . AUTH_MAGIC) == $data['password'] ){ 65 $this->customer_data = $data; 66 $this->startSession(); 67 return true; 68 } 69 return false; 70 } 71 72 /** 73 * ·ÈÂÓüËöID¤¬°ìÃפ¹¤ë²ñ°÷¤¬Â¸ºß¤¹¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£ 74 * 75 * @return boolean ³ºÅö¤¹¤ë²ñ°÷¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ï true¡¢¤½¤ì°Ê³°¤Î¾ì¹ç 76 * ¤Ï false ¤òÊÖ¤¹¡£ 77 */ 78 function checkMobilePhoneId() { 79 if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) { 80 return false; 81 } 82 83 // ·ÈÂÓüËöID¤¬°ìÃפ·¡¢ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤ò¸¡º÷¤¹¤ë¡£ 84 $sql = 'SELECT count(*) FROM dtb_customer WHERE mobile_phone_id = ? AND del_flg = 0 AND status = 2'; 85 $result = $this->conn->getOne($sql, array($_SESSION['mobile']['phone_id'])); 86 return $result > 0; 87 } 88 89 /** 90 * ·ÈÂÓüËöID¤ò»ÈÍѤ·¤Æ²ñ°÷¤ò¸¡º÷¤·¡¢¥Ñ¥¹¥ï¡¼¥É¤Î¾È¹ç¤ò¹Ô¤¦¡£ 91 * ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¸ÜµÒ¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£ 92 * 93 * @param string $pass ¥Ñ¥¹¥ï¡¼¥É 94 * @return boolean ³ºÅö¤¹¤ë²ñ°÷¤¬Â¸ºß¤·¡¢¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï true¡¢ 95 * ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£ 96 */ 97 function getCustomerDataFromMobilePhoneIdPass($pass) { 98 if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) { 99 return false; 100 } 101 102 // ·ÈÂÓüËöID¤¬°ìÃפ·¡¢ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤ò¸¡º÷¤¹¤ë¡£ 103 $sql = 'SELECT * FROM dtb_customer WHERE mobile_phone_id = ? AND del_flg = 0 AND status = 2'; 104 @list($data) = $this->conn->getAll($sql, array($_SESSION['mobile']['phone_id'])); 105 106 // ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¸ÜµÒ¾ðÊó¤òcustomer_data¤Ë³ÊǼ¤·¤Ætrue¤òÊÖ¤¹¡£ 107 if (sha1($pass . ':' . AUTH_MAGIC) == @$data['password']) { 108 $this->customer_data = $data; 109 $this->startSession(); 110 return true; 111 } 112 return false; 113 } 114 115 /** 116 * ·ÈÂÓüËöID¤òÅÐÏ¿¤¹¤ë¡£ 117 * 118 * @return void 119 */ 120 function updateMobilePhoneId() { 121 if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) { 122 return; 123 } 124 125 if ($this->customer_data['mobile_phone_id'] == $_SESSION['mobile']['phone_id']) { 126 return; 127 } 128 129 $objQuery = new SC_Query; 130 $sqlval = array('mobile_phone_id' => $_SESSION['mobile']['phone_id']); 131 $where = 'customer_id = ? AND del_flg = 0 AND status = 2'; 132 $objQuery->update('dtb_customer', $sqlval, $where, array($this->customer_data['customer_id'])); 133 134 $this->customer_data['mobile_phone_id'] = $_SESSION['mobile']['phone_id']; 135 } 136 137 /** 138 * email ¤«¤é email_mobile ¤Ø·ÈÂӤΥ᡼¥ë¥¢¥É¥ì¥¹¤ò¥³¥Ô¡¼¤¹¤ë¡£ 139 * 140 * @return void 141 */ 142 function updateEmailMobile() { 143 // ¤¹¤Ç¤Ë email_mobile ¤ËÃͤ¬Æþ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï²¿¤â¤·¤Ê¤¤¡£ 144 if ($this->customer_data['email_mobile'] != '') { 145 return; 146 } 147 148 // email ¤¬·ÈÂӤΥ᡼¥ë¥¢¥É¥ì¥¹¤Ç¤Ï¤Ê¤¤¾ì¹ç¤Ï²¿¤â¤·¤Ê¤¤¡£ 149 if (!gfIsMobileMailAddress($this->customer_data['email'])) { 150 return; 151 } 152 153 // email ¤«¤é email_mobile ¤Ø¥³¥Ô¡¼¤¹¤ë¡£ 154 $objQuery = new SC_Query; 155 $sqlval = array('email_mobile' => $this->customer_data['email']); 156 $where = 'customer_id = ? AND del_flg = 0 AND status = 2'; 157 $objQuery->update('dtb_customer', $sqlval, $where, array($this->customer_data['customer_id'])); 158 159 $this->customer_data['email_mobile'] = $this->customer_data['email']; 160 } 161 162 // ¥Ñ¥¹¥ï¡¼¥É¤ò³Îǧ¤»¤º¤Ë¥í¥°¥¤¥ó 163 function setLogin($email) { 164 // ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß 165 $sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND del_flg = 0 AND status = 2"; 166 $result = $this->conn->getAll($sql, array($email)); 167 $data = $result[0]; 168 $this->customer_data = $data; 169 $this->startSession(); 170 } 171 172 // ¥»¥Ã¥·¥ç¥ó¾ðÊó¤òºÇ¿·¤Î¾ðÊó¤Ë¹¹¿·¤¹¤ë 173 function updateSession() { 174 $sql = "SELECT * FROM dtb_customer WHERE customer_id = ? AND del_flg = 0"; 175 $customer_id = $this->getValue('customer_id'); 176 $arrRet = $this->conn->getAll($sql, array($customer_id)); 177 $this->customer_data = $arrRet[0]; 178 $_SESSION['customer'] = $this->customer_data; 179 } 180 181 // ¥í¥°¥¤¥ó¾ðÊó¤ò¥»¥Ã¥·¥ç¥ó¤ËÅÐÏ¿¤·¡¢¥í¥°¤Ë½ñ¤¹þ¤à 182 function startSession() { 183 sfDomainSessionStart(); 184 $_SESSION['customer'] = $this->customer_data; 185 // ¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÊݸ 186 gfPrintLog("access : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH ); 187 } 188 189 // ¥í¥°¥¢¥¦¥È¡¡$_SESSION['customer']¤ò²òÊü¤·¡¢¥í¥°¤Ë½ñ¤¹þ¤à 190 function EndSession() { 191 // $_SESSION['customer']¤Î²òÊü 192 unset($_SESSION['customer']); 193 // ¥í¥°¤ËµÏ¿¤¹¤ë 194 gfPrintLog("logout : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH ); 195 } 196 197 // ¥í¥°¥¤¥ó¤ËÀ®¸ù¤·¤Æ¤¤¤ë¤«È½Äꤹ¤ë¡£ 198 function isLoginSuccess($dont_check_email_mobile = false) { 199 // ¥í¥°¥¤¥ó»þ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÈDB¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬°ìÃפ·¤Æ¤¤¤ë¾ì¹ç 200 if(sfIsInt($_SESSION['customer']['customer_id'])) { 201 $objQuery = new SC_Query(); 202 $email = $objQuery->get("dtb_customer", "email", "customer_id = ?", array($_SESSION['customer']['customer_id'])); 203 if($email == $_SESSION['customer']['email']) { 204 // ¥â¥Ð¥¤¥ë¥µ¥¤¥È¤Î¾ì¹ç¤Ï·ÈÂӤΥ᡼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¤³¤È¤â¥Á¥§¥Ã¥¯¤¹¤ë¡£ 205 // ¤¿¤À¤· $dont_check_email_mobile ¤¬ true ¤Î¾ì¹ç¤Ï¥Á¥§¥Ã¥¯¤·¤Ê¤¤¡£ 206 if (defined('MOBILE_SITE') && !$dont_check_email_mobile) { 207 $email_mobile = $objQuery->get("dtb_customer", "email_mobile", "customer_id = ?", array($_SESSION['customer']['customer_id'])); 208 return isset($email_mobile); 209 } 210 return true; 211 } 212 } 213 return false; 214 } 215 216 // ¥Ñ¥é¥á¡¼¥¿¤Î¼èÆÀ 217 function getValue($keyname) { 218 return $_SESSION['customer'][$keyname]; 219 } 220 221 // ¥Ñ¥é¥á¡¼¥¿¤Î¥»¥Ã¥È 222 function setValue($keyname, $val) { 223 $_SESSION['customer'][$keyname] = $val; 224 } 225 226 // ¥Ñ¥é¥á¡¼¥¿¤¬NULL¤«¤É¤¦¤«¤ÎȽÄê 227 function hasValue($keyname) { 228 return isset($_SESSION['customer'][$keyname]); 229 } 230 231 // ÃÂÀ¸Æü·î¤Ç¤¢¤ë¤«¤É¤¦¤«¤ÎȽÄê 232 function isBirthMonth() { 233 $arrRet = split("[- :/]", $_SESSION['customer']['birth']); 234 $birth_month = intval($arrRet[1]); 235 $now_month = intval(date("m")); 236 237 if($birth_month == $now_month) { 238 return true; 239 } 240 return false; 241 } 13 var $conn; 14 var $email; 15 var $customer_data; // ²ñ°÷¾ðÊó 16 17 function SC_Customer( $conn = '', $email = '', $pass = '' ) { 18 // ¥»¥Ã¥·¥ç¥ó³«»Ï 19 /* startSession¤«¤é°ÜÆ° 2005/11/04 ÃæÀî */ 20 sfDomainSessionStart(); 21 22 // DBÀܳ¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À® 23 $DB_class_name = "SC_DbConn"; 24 if ( is_object($conn)){ 25 if ( is_a($conn, $DB_class_name)){ 26 // $conn¤¬$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¤¢¤ë 27 $this->conn = $conn; 28 } 29 } else { 30 if (class_exists($DB_class_name)){ 31 //$DB_class_name¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òºîÀ®¤¹¤ë 32 $this->conn = new SC_DbConn(); 33 } 34 } 35 36 if ( is_object($this->conn) ) { 37 // Àµ¾ï¤ËDB¤ËÀܳ¤Ç¤¤ë 38 if ( $email ){ 39 // email¤«¤é¸ÜµÒ¾ðÊó¤ò¼èÆÀ¤¹¤ë 40 // $this->setCustomerDataFromEmail( $email ); 41 } 42 } else { 43 echo "DBÀܳ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÀ¸À®¤Ë¼ºÇÔ¤·¤Æ¤¤¤Þ¤¹"; 44 exit; 45 } 46 47 if ( strlen($email) > 0 && strlen($pass) > 0 ){ 48 $this->getCustomerDataFromEmailPass($pass, $email); 49 } 50 } 51 52 function getCustomerDataFromEmailPass( $pass, $email, $mobile = false ) { 53 $email = strtolower($email); 54 $sql_mobile = $mobile ? ' OR email_mobile = ?' : ''; 55 $arrValues = array($email); 56 if ($mobile) { 57 $arrValues[] = $email; 58 } 59 // ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß 60 $sql = "SELECT * FROM dtb_customer WHERE (email = ?" . $sql_mobile . ") AND del_flg = 0 AND status = 2"; 61 $result = $this->conn->getAll($sql, $arrValues); 62 63 if (empty($result[0])) { 64 return false; 65 } 66 67 $data = $result[0]; 68 69 // ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ì¤Ð¸ÜµÒ¾ðÊó¤òcustomer_data¤Ë¥»¥Ã¥È¤·¤Ætrue¤òÊÖ¤¹ 70 if ( sha1($pass . ":" . AUTH_MAGIC) == $data['password'] ){ 71 $this->customer_data = $data; 72 $this->startSession(); 73 return true; 74 } 75 return false; 76 } 77 78 /** 79 * ·ÈÂÓüËöID¤¬°ìÃפ¹¤ë²ñ°÷¤¬Â¸ºß¤¹¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡£ 80 * 81 * @return boolean ³ºÅö¤¹¤ë²ñ°÷¤¬Â¸ºß¤¹¤ë¾ì¹ç¤Ï true¡¢¤½¤ì°Ê³°¤Î¾ì¹ç 82 * ¤Ï false ¤òÊÖ¤¹¡£ 83 */ 84 function checkMobilePhoneId() { 85 if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) { 86 return false; 87 } 88 89 // ·ÈÂÓüËöID¤¬°ìÃפ·¡¢ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤ò¸¡º÷¤¹¤ë¡£ 90 $sql = 'SELECT count(*) FROM dtb_customer WHERE mobile_phone_id = ? AND del_flg = 0 AND status = 2'; 91 $result = $this->conn->getOne($sql, array($_SESSION['mobile']['phone_id'])); 92 return $result > 0; 93 } 94 95 /** 96 * ·ÈÂÓüËöID¤ò»ÈÍѤ·¤Æ²ñ°÷¤ò¸¡º÷¤·¡¢¥Ñ¥¹¥ï¡¼¥É¤Î¾È¹ç¤ò¹Ô¤¦¡£ 97 * ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¸ÜµÒ¾ðÊó¤ò¼èÆÀ¤¹¤ë¡£ 98 * 99 * @param string $pass ¥Ñ¥¹¥ï¡¼¥É 100 * @return boolean ³ºÅö¤¹¤ë²ñ°÷¤¬Â¸ºß¤·¡¢¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï true¡¢ 101 * ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï false ¤òÊÖ¤¹¡£ 102 */ 103 function getCustomerDataFromMobilePhoneIdPass($pass) { 104 if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) { 105 return false; 106 } 107 108 // ·ÈÂÓüËöID¤¬°ìÃפ·¡¢ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤ò¸¡º÷¤¹¤ë¡£ 109 $sql = 'SELECT * FROM dtb_customer WHERE mobile_phone_id = ? AND del_flg = 0 AND status = 2'; 110 @list($data) = $this->conn->getAll($sql, array($_SESSION['mobile']['phone_id'])); 111 112 // ¥Ñ¥¹¥ï¡¼¥É¤¬¹ç¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢¸ÜµÒ¾ðÊó¤òcustomer_data¤Ë³ÊǼ¤·¤Ætrue¤òÊÖ¤¹¡£ 113 if (sha1($pass . ':' . AUTH_MAGIC) == @$data['password']) { 114 $this->customer_data = $data; 115 $this->startSession(); 116 return true; 117 } 118 return false; 119 } 120 121 /** 122 * ·ÈÂÓüËöID¤òÅÐÏ¿¤¹¤ë¡£ 123 * 124 * @return void 125 */ 126 function updateMobilePhoneId() { 127 if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) { 128 return; 129 } 130 131 if ($this->customer_data['mobile_phone_id'] == $_SESSION['mobile']['phone_id']) { 132 return; 133 } 134 135 $objQuery = new SC_Query; 136 $sqlval = array('mobile_phone_id' => $_SESSION['mobile']['phone_id']); 137 $where = 'customer_id = ? AND del_flg = 0 AND status = 2'; 138 $objQuery->update('dtb_customer', $sqlval, $where, array($this->customer_data['customer_id'])); 139 140 $this->customer_data['mobile_phone_id'] = $_SESSION['mobile']['phone_id']; 141 } 142 143 /** 144 * email ¤«¤é email_mobile ¤Ø·ÈÂӤΥ᡼¥ë¥¢¥É¥ì¥¹¤ò¥³¥Ô¡¼¤¹¤ë¡£ 145 * 146 * @return void 147 */ 148 function updateEmailMobile() { 149 // ¤¹¤Ç¤Ë email_mobile ¤ËÃͤ¬Æþ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï²¿¤â¤·¤Ê¤¤¡£ 150 if ($this->customer_data['email_mobile'] != '') { 151 return; 152 } 153 154 // email ¤¬·ÈÂӤΥ᡼¥ë¥¢¥É¥ì¥¹¤Ç¤Ï¤Ê¤¤¾ì¹ç¤Ï²¿¤â¤·¤Ê¤¤¡£ 155 if (!gfIsMobileMailAddress($this->customer_data['email'])) { 156 return; 157 } 158 159 // email ¤«¤é email_mobile ¤Ø¥³¥Ô¡¼¤¹¤ë¡£ 160 $objQuery = new SC_Query; 161 $sqlval = array('email_mobile' => $this->customer_data['email']); 162 $where = 'customer_id = ? AND del_flg = 0 AND status = 2'; 163 $objQuery->update('dtb_customer', $sqlval, $where, array($this->customer_data['customer_id'])); 164 165 $this->customer_data['email_mobile'] = $this->customer_data['email']; 166 } 167 168 // ¥Ñ¥¹¥ï¡¼¥É¤ò³Îǧ¤»¤º¤Ë¥í¥°¥¤¥ó 169 function setLogin($email) { 170 // ËÜÅÐÏ¿¤µ¤ì¤¿²ñ°÷¤Î¤ß 171 $sql = "SELECT * FROM dtb_customer WHERE email ILIKE ? AND del_flg = 0 AND status = 2"; 172 $result = $this->conn->getAll($sql, array($email)); 173 $data = $result[0]; 174 $this->customer_data = $data; 175 $this->startSession(); 176 } 177 178 // ¥»¥Ã¥·¥ç¥ó¾ðÊó¤òºÇ¿·¤Î¾ðÊó¤Ë¹¹¿·¤¹¤ë 179 function updateSession() { 180 $sql = "SELECT * FROM dtb_customer WHERE customer_id = ? AND del_flg = 0"; 181 $customer_id = $this->getValue('customer_id'); 182 $arrRet = $this->conn->getAll($sql, array($customer_id)); 183 $this->customer_data = $arrRet[0]; 184 $_SESSION['customer'] = $this->customer_data; 185 } 186 187 // ¥í¥°¥¤¥ó¾ðÊó¤ò¥»¥Ã¥·¥ç¥ó¤ËÅÐÏ¿¤·¡¢¥í¥°¤Ë½ñ¤¹þ¤à 188 function startSession() { 189 sfDomainSessionStart(); 190 $_SESSION['customer'] = $this->customer_data; 191 // ¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÊݸ 192 gfPrintLog("access : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH ); 193 } 194 195 // ¥í¥°¥¢¥¦¥È¡¡$_SESSION['customer']¤ò²òÊü¤·¡¢¥í¥°¤Ë½ñ¤¹þ¤à 196 function EndSession() { 197 // $_SESSION['customer']¤Î²òÊü 198 unset($_SESSION['customer']); 199 // ¥í¥°¤ËµÏ¿¤¹¤ë 200 gfPrintLog("logout : user=".$this->customer_data['customer_id'] ."\t"."ip=". $_SERVER['REMOTE_HOST'], CUSTOMER_LOG_PATH ); 201 } 202 203 // ¥í¥°¥¤¥ó¤ËÀ®¸ù¤·¤Æ¤¤¤ë¤«È½Äꤹ¤ë¡£ 204 function isLoginSuccess($dont_check_email_mobile = false) { 205 // ¥í¥°¥¤¥ó»þ¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤ÈDB¤Î¥á¡¼¥ë¥¢¥É¥ì¥¹¤¬°ìÃפ·¤Æ¤¤¤ë¾ì¹ç 206 if(sfIsInt($_SESSION['customer']['customer_id'])) { 207 $objQuery = new SC_Query(); 208 $email = $objQuery->get("dtb_customer", "email", "customer_id = ?", array($_SESSION['customer']['customer_id'])); 209 if($email == $_SESSION['customer']['email']) { 210 // ¥â¥Ð¥¤¥ë¥µ¥¤¥È¤Î¾ì¹ç¤Ï·ÈÂӤΥ᡼¥ë¥¢¥É¥ì¥¹¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¤³¤È¤â¥Á¥§¥Ã¥¯¤¹¤ë¡£ 211 // ¤¿¤À¤· $dont_check_email_mobile ¤¬ true ¤Î¾ì¹ç¤Ï¥Á¥§¥Ã¥¯¤·¤Ê¤¤¡£ 212 if (defined('MOBILE_SITE') && !$dont_check_email_mobile) { 213 $email_mobile = $objQuery->get("dtb_customer", "email_mobile", "customer_id = ?", array($_SESSION['customer']['customer_id'])); 214 return isset($email_mobile); 215 } 216 return true; 217 } 218 } 219 return false; 220 } 221 222 // ¥Ñ¥é¥á¡¼¥¿¤Î¼èÆÀ 223 function getValue($keyname) { 224 return $_SESSION['customer'][$keyname]; 225 } 226 227 // ¥Ñ¥é¥á¡¼¥¿¤Î¥»¥Ã¥È 228 function setValue($keyname, $val) { 229 $_SESSION['customer'][$keyname] = $val; 230 } 231 232 // ¥Ñ¥é¥á¡¼¥¿¤¬NULL¤«¤É¤¦¤«¤ÎȽÄê 233 function hasValue($keyname) { 234 return isset($_SESSION['customer'][$keyname]); 235 } 236 237 // ÃÂÀ¸Æü·î¤Ç¤¢¤ë¤«¤É¤¦¤«¤ÎȽÄê 238 function isBirthMonth() { 239 $arrRet = split("[- :/]", $_SESSION['customer']['birth']); 240 $birth_month = intval($arrRet[1]); 241 $now_month = intval(date("m")); 242 243 if($birth_month == $now_month) { 244 return true; 245 } 246 return false; 247 } 242 248 } 243 249 ?>
Note: See TracChangeset
for help on using the changeset viewer.