完美整合X2.5和phpcms 2008 phpcms V9实现同步登陆论坛免激活
完美整合X2.5和DEDECMS实现同步登陆论坛免激活
ps:前提是你已经能够做到同步登录,同步退出,以及同步注册了~~~
现在剩下的问题就是,在其他的产品注册后,DZ里面还需要首次登录后还需要激活,才能正常使用.
现在要做的就是DZ不用激活也能同步登录
只需要修改下discuz的uc.php文件既可免激活同步登陆论坛文件位于论坛的api文件夹内修改180行的function synlogin($get, $post) { ...
只需要修改下discuz的uc.php文件既可免激活同步登陆论坛文件位于论坛的api文件夹内
修改180行的
function synlogin($get, $post) { global $_G; if(!API_SYNLOGIN) { return API_RETURN_FORBIDDEN; } header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); $cookietime = 31536000; $uid = intval($get['uid']); if(($member = getuserbyuid($uid, 1))) { dsetcookie('auth', authcode("$member[password]\t$member[uid]", 'ENCODE'), $cookietime); } }
修改为:
function synlogin($get, $post) { global $_G; if(!API_SYNLOGIN) { return API_RETURN_FORBIDDEN; } header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); $cookietime = 31536000; $uid = intval($get['uid']); $query = DB::query("SELECT uid, username, password FROM ".DB::table('common_member')." WHERE uid='$uid'"); if($member = DB::fetch($query)) { dsetcookie('auth', authcode("$member[password]\t$member[uid]", 'ENCODE'), $cookietime); }else{ $username = $get['username']; $query = DB::query("SELECT uid, username, password,email FROM ".DB::table('ucenter_members')." WHERE username='$username'"); $member = DB::fetch($query); $password = $member['password']; $email = $member['email']; $ip = $_SERVER['REMOTE_ADDR']; $time = time(); $userdata = array( 'uid' => $uid, 'username' => $username, 'password' => $password, 'email' => $email, 'adminid' => 0, 'groupid' => 10, 'regdate' => $time, 'credits' => 0, 'timeoffset' => 9999 ); DB::insert('common_member', $userdata); $status_data = array( 'uid' => $uid, 'regip' => $ip, 'lastip' => $ip, 'lastvisit' => $time, 'lastactivity' => $time, 'lastpost' => 0, 'lastsendmail' => 0, ); DB::insert('common_member_status', $status_data); DB::insert('common_member_profile', array('uid' => $uid)); DB::insert('common_member_field_forum', array('uid' => $uid)); DB::insert('common_member_field_home', array('uid' => $uid)); DB::insert('common_member_count', array('uid' => $uid)); DB::query("UPDATE ".DB::table('common_setting')." SET svalue='$username' WHERE skey='lastmember'"); $query = DB::query("SELECT uid, username, password FROM ".DB::table('common_member')." WHERE uid='$uid'"); if($member = DB::fetch($query)) { dsetcookie('auth', authcode("$member[password]\t$member[uid]", 'ENCODE'), $cookietime); } } } // end
修改完成后,就OK了