查看: 844|回复: 2

[已解决] 解决第一次注册需要在DISCUZ当中登陆一次才可以同步!

[复制链接]
发表于 2012-12-3 10:51:45 | 显示全部楼层 |阅读模式
本帖最后由 ss8021 于 2012-12-3 10:55 编辑

隔壁论坛抄过来的,亲测可以用,免费分享给大家,大神看到可以研究优化一下代码,哈哈!
第一步:找到 api/uc.php 文件 查找下列代码并删除,请注意备份一个UC.PHP

  1. function synlogin($get, $post) {
  2. global $_G;
  3. if(!API_SYNLOGIN) {
  4. return API_RETURN_FORBIDDEN;
  5. }
  6. header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
  7. $cookietime = 31536000;
  8. $uid = intval($get['uid']);
  9. $query = DB::query("SELECT uid, username, password FROM ".DB::table('common_member')." WHERE uid='$uid'");
  10. if($member = DB::fetch($query)) {
  11. dsetcookie('auth', authcode("$member[password]\t$member[uid]", 'ENCODE'), $cookietime);
  12. }
  13. }

复制代码
第二步:

  1. //start Discuz!X1.5免激活功能 BY Jongye



  2. function synlogin($get, $post) {
  3. global $_G;

  4. if(!API_SYNLOGIN) {
  5. return API_RETURN_FORBIDDEN;
  6. }

  7. header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');

  8. $cookietime = 31536000;
  9. $uid = intval($get['uid']);
  10. $query = DB::query("SELECT uid, username, password FROM ".DB::table('common_member')." WHERE uid='$uid'");
  11. if($member = DB::fetch($query)) {
  12. dsetcookie('auth', authcode("$member[password]\t$member[uid]", 'ENCODE'), $cookietime);
  13. }else{

  14. $username = $get['username'];
  15. $query = DB::query("SELECT uid, username, password,email FROM ".DB::table('ucenter_members')." WHERE username='$username'");
  16. $member = DB::fetch($query);
  17. $password = $member['password'];
  18. $email = $member['email'];
  19. $ip = $_SERVER['REMOTE_ADDR'];
  20. $time = time();


  21. $userdata = array(
  22. 'uid' => $uid,
  23. 'username' => $username,
  24. 'password' => $password,
  25. 'email' => $email,
  26. 'adminid' => 0,
  27. 'groupid' => 10,
  28. 'regdate' => $time,
  29. 'credits' => 0,
  30. 'timeoffset' => 9999
  31. );
  32. DB::insert('common_member', $userdata);

  33. $status_data = array(
  34. 'uid' => $uid,
  35. 'regip' => $ip,
  36. 'lastip' => $ip,
  37. 'lastvisit' => $time,
  38. 'lastactivity' => $time,
  39. 'lastpost' => 0,
  40. 'lastsendmail' => 0,
  41. );
  42. DB::insert('common_member_status', $status_data);
  43. DB::insert('common_member_profile', array('uid' => $uid));
  44. DB::insert('common_member_field_forum', array('uid' => $uid));
  45. DB::insert('common_member_field_home', array('uid' => $uid));
  46. DB::insert('common_member_count', array('uid' => $uid));
  47. DB::query("UPDATE ".DB::table('common_setting')." SET svalue='$username' WHERE skey='lastmember'");

  48. $query = DB::query("SELECT uid, username, password FROM ".DB::table('common_member')." WHERE uid='$uid'");
  49. if($member = DB::fetch($query)) {
  50. dsetcookie('auth', authcode("$member[password]\t$member[uid]", 'ENCODE'), $cookietime);
  51. }
  52. }

  53. }
  54. // end

复制代码
这样就欧了。
 楼主| 发表于 2012-12-3 10:55:59 | 显示全部楼层
还要审核,晕菜.......
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-1-10 14:17:36 | 显示全部楼层
。。。。。。。。。。。。。。。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 点击这里注册

本版积分规则

小黑屋|Archiver|phpcms网站管理系统 ( 京ICP备14011169 )

GMT+8, 2019-9-23 19:38 , Processed in 0.217184 second(s), 7 queries , Memcache On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表