public function getDomainId($domain) { $domainId = false; $domainRow = $this->_db->fetchRow('SELECT `id` FROM `domains` WHERE `name`=?', $domain); if (!empty($domainRow)) { $domainId = $domainRow['id']; } return $domainId; }
/** * 会员登录 * * @param string $username 用户名 * @param string $password 密码 */ public function login($data) { $username = $data['username']; $password = $data['password']; if (empty($username)) { throw new Zend_Exception('用户名或邮箱不能为空'); } if (empty($password)) { throw new Zend_Exception('密码不能为空'); } $password = md5(md5($password)); $where = $this->_db->quoteInto('username=? ', strtolower($username)); $select = $this->_db->select()->from('user')->where($where); $info = $this->_db->fetchRow($select); if (empty($info)) { throw new Zend_Exception('用户名不存在,请查证'); } if ($password != $info['password']) { throw new Zend_Exception('用户名密码错误请查证'); } $lifeTime = empty($data['lifetime']) ? '3600' : $data['lifetime']; $userInfo = new YUN_ArrayObject($info); session_cache_limiter('private'); $this->_login($userInfo); Zend_Session::rememberMe($lifeTime); $this->updateLogin($userInfo->uid); return $info; }
/** * Enter description here ... * @param string $id * @return array Intro */ public function getIntroDetail($id) { $row = $this->db->fetchRow("SELECT * FROM intro WHERE id = ? ORDER BY sort DESC", array($id)); return $row; }