search
Homephp教程PHP源码Discuz论坛2.5 升级到PHP MySQL新版遇到的问题

<script>ec(2);</script>
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'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;
}
}
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.