﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>癫狂蚊子的痴狂世界 &#187; base64</title>
	<atom:link href="http://www.askgame.com.cn/index.php/game/tag/base64/feed" rel="self" type="application/rss+xml" />
	<link>http://www.askgame.com.cn</link>
	<description>一切对我而言都是游戏! Everything is Game!</description>
	<lastBuildDate>Wed, 07 Jul 2010 07:20:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>php中base64_encode()加密和DEDEEIMS的更改数据表前缀</title>
		<link>http://www.askgame.com.cn/index.php/game/315</link>
		<comments>http://www.askgame.com.cn/index.php/game/315#comments</comments>
		<pubDate>Sat, 30 Jan 2010 15:59:38 +0000</pubDate>
		<dc:creator>癫狂蚊子</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[dede]]></category>
		<category><![CDATA[eims]]></category>

		<guid isPermaLink="false">http://www.askgame.com.cn/?p=315</guid>
		<description><![CDATA[今天在使用DEDE做的EIMS的时候，出现了一个小问题，当我更改其数据表前缀后，添加新闻报错，找不到dede_archives表，我以为是程序的问题，找了半天，在程序中始终无法找到问题所在，就快要疯了的时候，总算在数据库当中找到了原因，在dede_channeltype中有个maintable的字段，这个字段默认为dede_archives，如果你更改了数据表前缀，当然就找不到dede_archives这个表了，于是程序出错。
找到原因，马上开始弄，本以为在安装时的sql语句文件中能方便的进行修改，但未想到dede对sql语句使用MIME base64 进行了编码，一下无语，只好把SQL语句加在了程序当中。搞定。
心得如下：

1.php中的base64_decode()和base64_encode()方法可以对数据进行MIME base64的编码，Base64是网络上最常见的用于传输8Bit字节代码的编码方式之一，可用于在HTTP环境下传递较长的标识信息，例如电子邮件的主体。decode为解码，encode为编码。
示例：

//来源于PHP手册
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo base64_decode($str); //This is an encoded string

2.DEDE EIMS中当用户更改了数据表前缀后，在添加新闻动态等出现找不到表的错误提示时的修改方法。
打开install下面的index.php在约228行左右找到：
$cquery = "Update `{$dbprefix}sysconfig` set value='{$dfstyle}' where varname='cfg_df_style';";
mysql_query($cquery,$conn);
在其后面添加如下代码：

	//更新自定义模型中的主表数据 --by 癫狂蚊子 2010年1月30日
	$cquery = "Update `{$dbprefix}channeltype` set maintable='{$dbprefix}archives' where maintable='dede_archives';";
	mysql_query($cquery,$conn);
	//更新自定义模型中的主表默认的主表名 --by 癫狂蚊子 2010年1月30日
	$cquery = "alter table `{$dbprefix}channeltype` alter maintable set default '{$dbprefix}archives';";
	echo $cquery;
	mysql_query($cquery,$conn);

重新安装即可！
或者，在 系统设置&#8211;》SQL命令行工具里面自行更改相关数据，主要涉及表为#@_channeltype,#@_为你的数据表前缀！
]]></description>
		<wfw:commentRss>http://www.askgame.com.cn/index.php/game/315/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
