整合discuz会员同步(没试过)

好象说用UCENTER也可以,还没试。下面转的

<?php
define('IN_DISCUZ',TRUE);
define('CURSCRIPT', 'logging');
require "./bbs/config.inc.php";
require './bbs/include/global.func.php';//验证码转换的实现
require './bbs/uc_client/client.php';//uc登陆相关
/// 以上为DZ相关
$m=new CMySQL($dbhost,$dbuser,$dbpw,$dbname);
///数据准备
$sid=isset($_COOKIE[$cookiepre."sid"])?$_COOKIE[$cookiepre."sid"]:"";//COOKIE数据:sid,$cookiepre在config.inc.php中定义
if($sid!="")//当cookie中有sid的时候,检测该用户是否已经登陆
{
  $SQL="select seccode,uid,username from ".$tablepre."sessions where sid=\"".$_COOKIE[$cookiepre."sid"]."\" limit 1";//验证码
  $sess=$m->DoQuery($SQL);
  if($sess[0]["username"]!="")//数据库中该sid所对应的用户已经登陆
  {
  $login=1;
  $SQL="select uid,username,email from ".$tablepre."members where uid=".$sess[0]["uid"]." limit 1";
  $data=$m->DoQuery($SQL);
  $uid=$data[0]["uid"];
  $username=$data[0]["username"];
  $email=$data[0]["email"];
  }
  else $login=0;//登陸失敗
}
if(isset($_POST["message"])) //检测是否有数据提交
{
  if($username!="")
  {
  if($message!="")
  {
  if($code!="")
  {
  $key=$sess[0]["seccode"];
  seccodeconvert($key);
  if(strtoupper($key)===strtoupper($code))//这里是验证码检测
  {
  //... //插入新数据
  $SQL="update ".$tablepre."sessions set seccode=0 where sid=\"$sid\""; //清除原有验证码信息
$m->DoQueryNoReturn($SQL);
  }
  else $error_info="验证码错误!";
  }
  else $error_info="验证码不能为空!";
  }
  else
  $error_info="回复内容不能为空。";
  }
  else{ $error_info="未登錄!";$login=0;}
}
else if(isset($_POST["username"])) //检测是否有登陆表单数据提交
{
  if($login_user!="")
  {
  $ucresult = uc_user_login($login_user, $psd);
  list($uid,$username,$password,$email)=$ucresult;
  if($uid>0)
  {
  $SQL="update ".$tablepre."sessions set username='$username',uid=$uid where sid='$sid'";//更新_sessions数据表
  $m->DoQueryNoReturn($SQL);
  $login=1;
  }
  }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值