private function saveKey($c) { $c = self::getKeyName($c); $sql = "INSERT INTO {$this->T('www_cache_key')} SET `type`='{$c['type']}', `key`='{$c['key']}', `key_`='{$c['key_']}', `expire`='{$c['expire']}' ON DUPLICATE KEY UPDATE `type`='{$c['type']}', `expire`='{$c['expire']}'"; odb::db()->query($sql); }
/** * 删除登录SESSION * @param unknown_type $session_key */ public function delSessionKey($session_key) { if (!empty($session_key)) { $tmp_session_id = substr($session_key, 0, 32); if ($this->genSessionKey($tmp_session_id) == substr($session_key, 32)) { $session_id = $tmp_session_id; } else { return false; } } else { return false; } $table = $this->T('www_session'); $sql = "DELETE FROM {$table} WHERE Sesskey='{$session_id}' LIMIT 1"; odb::dbslave()->query($sql); if (odb::dbslave()->affectedRows()) { return true; } else { return false; } }
/** * 密码修改 * @param unknown_type $user 用户名 * @param unknown_type $password 旧密码 * @param unknown_type $newPassword 新密码 */ public function uppassword($user, $password, $newPassword) { if (strlen($user) > 35 || strlen($password) > 16 || strlen($newPassword) > 16) { return false; } $user = odb::db()->escape($user); $password = md5($this->secure . $password); $newPassword = md5($this->secure . $newPassword); $sql = "UPDATE {$this->T('www_admin')} SET password='******' WHERE user='******' AND password='******' LIMIT 1"; odb::db()->query($sql); return odb::db()->affectedRows(); }