Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[求助] 站点单点登陆同步用户信息问题请教大家。

[复制链接]
lsgzs 发表于 2015-6-2 22:18:52 | 显示全部楼层 |阅读模式
大家好,我自己写了个登陆页面,登陆论坛。但自己页面调用ucenter登陆成功后。
论坛还是显示没登陆,ucenter通信是正常的。但就是不能同步登陆。麻烦大家帮忙看下。

网上看到个代码,没看明白,这个代码该怎么用呢。PHP现在不懂。没办法。

<?php  

define('NOROBOT', FALSE);
define('ADMINSCRIPT', basename(__FILE__));
define('CURSCRIPT', 'admin');
define('HOOKTYPE', 'hookscript');
define('APPTYPEID', 0);
//define('CURMODULE', $mod);
require './source/class/class_core.php';
$discuz = C::app();
$discuz->init();
require libfile('function/member');
require libfile('class/member');
runhooks();
$newusername = trim($_GET['newusername']);
$newpassword = 'www.xxxx.com';//trim($_GET['newpassword']);
$newemail = isset($_GET['newemail'])? strtolower(trim($_GET['newemail']))newusername.'@xxx.com';
if(!$newusername || !$newemail) {
    showmessage('您目前未登录xxx网,暂时以游客身份只读访问论坛');
}
// 以下几句防止第3方伪造
$time= (int)($_GET["time"]);
$curdate= time();
$seckey=$time.$newusername.'www.xxx.com';
$seckey=  md5($seckey);
if($curdate-$time>1200 || $seckey!=$_GET['code']){
    showmessage('submit_invalid');
}
               
$_G['uid']='';
$userid=C::t('common_member')->fetch_uid_by_username($newusername);
    $_SERVER['REQUEST_METHOD'] = 'POST';//注册需要模拟POST防止2次校验不通过
    $_GET['formhash'] = formhash();// 防止 2次校验不通过
    $_G['group']['seccode']='';// 防止 2次校验不通过

if(!$userid){// 没有找到对应用户则调用注册
    $_GET['regsubmit']='yes';
    $_GET['infloat']='yes';
    $_GET['lssubmit']='yes';
    $ctl_obj = new register_ctl();
    $ctl_obj->setting = $_G['setting'];
    $ctl_obj->template = 'member/register';
   
    $_GET[''.$ctl_obj->setting['reginput']['username']]=$newusername;
    $_GET[''.$ctl_obj->setting['reginput']['password']]= $newpassword;
    $_GET[''.$ctl_obj->setting['reginput']['password2']]= $newpassword;
    $_GET[''.$ctl_obj->setting['reginput']['email']] =$newemail;
   
    $ctl_obj->on_register();
}
//uc_user_synlogout();
$_G['groupid'] = $_G['member']['groupid'] = 7;
$_G['uid'] = $_G['member']['uid'] = 0;
$_G['username'] = $_G['member']['username'] = $_G['member']['password'] = '';
               
// 登陆         
$_GET['loginsubmit']='yes';
$_GET['lssubmit']='';
$_GET['username']=$newusername;
$_GET['password']= $newpassword;      
$ctl_obj = new logging_ctl();
$ctl_obj->setting = $_G['setting'];
$ctl_obj->template = 'member/login';
$ctl_obj->on_login();
?>
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-11-16 02:16 , Processed in 0.057377 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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