日期:2014-04-21 浏览次数:20526 次
1 中文问题,在使用MySQL实例配置工具的使用,将使用的字符集设置为GBK,而不要设置为UTF-8
2 MySQL安装后密码无法访问问题:
mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
3 PHP有Warning
在php.ini里面找到
bug_combat_warning = 1 两行,1 改成 0
4 MySQL 对SQL插入实行更强的格式检查.所以如果某个列是整数,就不能使用''来插入.因此修改Discuz的一个函数如下
function updatesession() {
if(empty($GLOBALS['sessionupdated'])) {
global $db, $sessionexists, $sessionupdated, $sid, $onlineip, $discuz_uid, $discuz_user, $timestamp, $groupid, $styleid, $invisible, $discuz_action, $fid, $tid, $onlinehold, $logincredits, $table_sessions, $table_members, $user_lastactivity, $onlinehold;
if($sessionexists == 1) {
$db->query("UPDATE $table_sessions SET uid='$discuz_uid', username='$discuz_user', groupid='$groupid', styleid='$styleid', invisible='" . ($invisible==""?0:1) . "', action='$discuz_action', lastactivity='$timestamp', fid='" . ($fid==""?0:1) . "', tid='" . ($tid==""?0:1) . "' WHERE sid='$sid'");
if ($onlinehold && $user_lastactivity && $timestamp - $user_lastactivity > $onlinehold) {
$db->query("UPDATE $table_members SET lastvisit=lastactivity, lastactivity=$timestamp WHERE uid='$discuz_uid'", 'UNBUFFERED');
}
} else {
$ips = explode('.', $onlineip);
$db->query("DELETE FROM $table_sessions WHERE sid='$sid' OR lastactivity<($timestamp-$onlinehold) OR ('$discuz_uid'<>'0' AND uid='$discuz_uid') OR (uid='0' AND ip1='$ips[0]' AND ip2='$ips[1]' AND ip3='$ips[2]' AND ip4='$ips[3]' AND lastactivity>$timestamp-60)");
$db->query("INSERT INTO $table_sessions (sid, ip1, ip2, ip3, ip4, uid, username, groupid, styleid, invisible, action, lastactivity, fid, tid)
VALUES ('$sid', '$ips[0]', '$ips[1]', '$ips[2]', '$ips[3]', '$discuz_uid', '$discuz_user', '$groupid', '$styleid', '" . ($invisible==""?0:1) . "', '$discuz_action', '$timestamp', '" . ($fid==""?0:1) . "', '" . ($tid==""?0:1) . "')");
if($discuz_uid) {
$db->query("UPDATE $table_members SET credit=credit+".intval($logincredits).", lastip='$onlineip', lastvisit=lastactivity, lastactivity=$timestamp WHERE uid='$discuz_uid'", 'UNBUFFERED');
}
}
$sessionupdated = 1;
}
}