Problems with upgrading Discuz Forum 2.5 to the new version of PHP MySQL

Source: Internet
Author: User
Tags character set php mysql
1 Chinese problem, when using MySQL instance configuration tool, set the character set to GBK instead of UTF-8
2. The password cannot be accessed after MySQL is installed:
Mysql> SET PASSWORD
-> 'Some _ user' @ 'some _ host'= OLD_PASSWORD ('newpwd ');
3. PHP has Warning
In php. ini, find
Bug_combat_warning = 1. Change 1 to 0.
4. MySQL performs a stronger format check on SQL INSERT. Therefore, if a column is an integer, ''cannot be used for insert. Therefore, a function of Discuz is modified as follows:
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 = ""? ). "'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;
}
}


Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.