足球游戏_中国足彩网¥体育资讯$

dedecms注册的会员自动激活discuz论坛
来源:易贤网 阅读:836 次 日期:2016-06-18 09:13:32
温馨提示:易贤网小编为您整理了“dedecms注册的会员自动激活discuz论坛”,方便广大网友查阅!

dedecms整合discuz同步登录与退出并且不用激活

弄了一天,问题总算解决了,不过有点投机取巧,下面说下dedecms整合discuz后会员注册后不用激活的实现,以前做站时,一直在想,dede和 dz整合后,会员在网站注册后到论坛能不能不再激活,看着可不舒服,现在总算解决了,闲话不说了,下面进入正题,百度也不让发附件,只有啰嗦点了,呵呵, 比较长,分3篇:

1.首先找到dede-〉api-〉uc.php文件

打开uc.php,将内容替换为:

<?php

/**************************二次开发说明**************************************

此模块应用于dedecms5.6版本,请替换api文件夹的uc.php,替换后,通过dede注册的用户,

访问论坛系统可以免激活,实现同时登陆同时退出。

include_once (dirname(__file__)./../include/common.inc.php);

define('in_discuz', false);

define('uc_client_version', '1.5.0'); //note ucenter 版本标识

define('uc_client_release', '20081031');

define('api_deleteuser', 1); //note 用户删除 api 接口开关

define('api_renameuser', 1); //note 用户改名 api 接口开关

define('api_gettag', 1); //note 获取标签 api 接口开关

define('api_synlogin', 1); //note 同步登录 api 接口开关

define('api_synlogout', 1); //note 同步登出 api 接口开关

define('api_updatepw', 1); //note 更改用户密码 开关

define('api_updatebadwords', 1); //note 更新关键字列表 开关

define('api_updatehosts', 1); //note 更新域名解析缓存 开关

define('api_updateapps', 1); //note 更新应用列表 开关

define('api_updateclient', 1); //note 更新客户端缓存 开关

define('api_updatecredit', 1); //note 更新用户积分 开关

define('api_getcreditsettings', 1); //note 向 ucenter 提供积分设置 开关

define('api_getcredit', 1); //note 获取用户的某项积分 开关

define('api_updatecreditsettings', 1); //note 更新应用积分设置 开关

define('api_return_succeed', '1');

define('api_return_failed', '-1');

define('api_return_forbidden', '-2');

define('uc_client_root', dederoot.'/uc_client');

//note 普通的 http 通知方式

if(!defined('in_uc'))

{

error_reporting(0);

set_magic_quotes_runtime(0);

defined('magic_quotes_gpc') || define('magic_quotes_gpc', get_magic_quotes_gpc());

$_dcache = $get = $post = array();

$code = @$_get['code'];

parse_str(_authcode($code, 'decode', uc_key), $get);

if(magic_quotes_gpc)

{

$get = _stripslashes($get);

}

$timestamp = time();

if($timestamp - $get['time'] > 3600) {

exit('authracation has expiried');

}

if(empty($get)) {

exit('invalid request');

}

$action = $get['action'];

require_once uc_client_root.'/lib/xml.class.php';

$post = xml_unserialize(file_get_contents('php://input'));

if(in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings')))

{

$uc_note = new uc_note();

exit($uc_note->$get['action']($get, $post));

}else{

exit(api_return_failed);

}

//note include 通知方式

} else {

exit('invalid request');

}

class uc_note

{

var $dbconfig = '';

var $db = '';

var $appdir = '';

var $tablepre = 'dede_';

function _serialize($arr, $htmlon = 0)

{

if(!function_exists('xml_serialize'))

{

include_once uc_client_root.'/lib/xml.class.php';

}

return xml_serialize($arr, $htmlon);

}

function uc_note()

{

$this->appdir = dederoot;

$this->dbconfig = dedeinc.'/common.inc.php';

$this->db = $globals['dsql'];

$this->tablepre = $globals['cfg_dbprefix'];

}

function get_uids($uids)

{

include uc_client_root.'/client.php';

$members = explode(,, $uids);

empty($members) && exit(api_return_forbidden);

/*$members_username = array();

foreach($members as $id)

{

$row = uc_get_user($id,1);

$members_username[] = $row[1];

}

$comma_temps = implode(,, $members_username);

empty($comma_temps) && exit(api_return_forbidden);

$comma_uids = array();*/

//$row = $this->db->setquery(select mid from `dede_member` where userid in ($comma_temps));

$this->db->setquery(select mid from `dede_member` where mid in ($uids));

$this->db->execute();

while($row = $this->db->getarray())

{

$comma_uids[] = $row['mid'];

}

empty($comma_uids) && exit(api_return_forbidden);

return implode(,, $comma_uids);

}

function test($get, $post)

{

return api_return_succeed;

}

function deleteuser($get, $post)

{

$uids = $this->get_uids($get['ids']);

!api_deleteuser && exit(api_return_forbidden);

//note 用户删除 api 接口

$rs = $this->db->executenonequery2(delete from `dede_member` where mid in ($uids) and matt<>10 limit 1);

if($rs > 0)

{

$this->db->executenonequery(delete from `dede_member_tj` where mid in ($uids) limit 1);

$this->db->executenonequery(delete from `dede_member_space` where mid in ($uids) limit 1);

$this->db->executenonequery(delete from `dede_member_company` where mid in ($uids) limit 1);

$this->db->executenonequery(delete from `dede_member_person` where mid in ($uids) limit 1);

//删除用户相关数据

$this->db->executenonequery(delete from `dede_member_stow` where mid in ($uids) );

$this->db->executenonequery(delete from `dede_member_flink` where mid in ($uids) );

$this->db->executenonequery(delete from `dede_member_guestbook` where mid in ($uids) );

$this->db->executenonequery(delete from `dede_member_operation` where mid in ($uids) );

$this->db->executenonequery(delete from `dede_member_pms` where toid in ($uids) or fromid in ($uids) );

$this->db->executenonequery(delete from `dede_member_friends` where mid in ($uids) or fid in ($uids) );

$this->db->executenonequery(delete from `dede_member_vhistory` where mid in ($uids) or vid in ($uids) );

$this->db->executenonequery(delete from `dede_feedback` where mid in ($uids) );

$this->db->executenonequery(update `dede_archives` set mid='0' where mid in ($uids));

}

else

{

exit(api_return_forbidden);

}

return api_return_succeed;

}

function renameuser($get, $post)

{

$uids = $this->get_uids($get['ids']);

$usernameold = $get['oldusername'];

$usernamenew = $get['newusername'];

if(!api_renameuser)

{

return api_return_forbidden;

}

//note 获取标签 api 接口

$rs = $this->db->executenonequery2(update `dede_member` set userid='$usernamenew' where userid='$usernamenew' and matt<>10 limit 1);

if($rs > 0)

{

$this->db->executenonequery(update `dede_archives` set writer='$usernamenew' where writer='$usernamenew');

$this->db->executenonequery(update `dede_member_pms` set floginid=replace(floginid, 't$usernameold', 't$usernamenew'),tologinid=replace(tologinid, 't$usernameold', 't$usernamenew'));

$row = $this->db->getone(show table status);

$db_tables = $row['name']; unset($row);

if(in_array($this->tablepre.'guestbook',$db_tables))

{

$this->db->executenonequery(update `dede_guestbook` set uname='$usernamenew' where uname='$usernamenew');

}

if(in_array($this->tablepre.'story_books',$db_tables))

{

$this->db->executenonequery(update `dede_story_books` set author='$usernamenew' where author='$usernamenew');

}

if(in_array($this->tablepre.'groups',$db_tables))

{

$this->db->executenonequery(update `dede_groups` set creater='$usernamenew' where creater='$usernamenew');

$this->db->executenonequery(update `dede_group_threads` set author='$usernamenew' where author='$usernamenew');

$this->db->executenonequery(update `dede_group_user` set username='$usernamenew' where username='$usernamenew');

$this->db->executenonequery(update `dede_group_posts` set author='$usernamenew' where author='$usernamenew');

$this->db->executenonequery(update `dede_group_guestbook` set uname='$usernamenew' where uname='$usernamenew');

$this->db->executenonequery(update `dede_groups` set ismaster=replace(ismaster, 't$usernameold', 't$usernamenew'));

}

return api_return_succeed;

}

else

{

return api_return_forbidden;

}

}

function gettag($get, $post)

{

$name = $get['id'];

if(!api_gettag)

{

return api_return_forbidden;

}

//note 获取标签 api 接口

$name = trim($name);

if(empty($name) || !preg_match('/^([x7f-xff_-]|w|s)+$/', $name) || strlen($name) > 20)

{

return api_return_failed;

}

$row = $this->db->getone(select `total`,`id` from `dede_tagindex` where `tag`='$name');

if(!is_array($row))

{

return api_return_failed;

}

$tpp = $row['total'] > 10 ? 10 : $row['total'];

$ids = array();

$this->db->setquery(select aid from `dede_taglist` where `tid`='$row[id]' and arcrank>-1);

$this->db->execute();

while($row = $this->db->getarray())

{

$ids[] = $row['aid'];

}

if(empty($ids))

{

return api_return_failed;

}

$aids = implode(,, $ids);

include_once dedeinc.'/channelunit.func.php';

$archives_list = array();

$this->db->setquery(select arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath

from `dede_archives` arc left join `dede_arctype` tp on arc.typeid=tp.id where arc.id in($aids) order by id desc limit $tpp);

$this->db->execute();

while($row = $this->db->getarray())

{

$row['url'] = getfileurl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);

$row['url'] = !ereg('http:',$row['url']) ? $globals['cfg_basehost'].$row['url'] : $row['url'];

if(!empty($row['url']))

{

$archives_list[] = array('title' => $row['title'],'writer' => $row['writer'],'pubdate' => $row['pubdate'],'url' => $row['url']);

}

}

$return = array($name, $archives_list);

return $this->_serialize($return, 1);

}

function synlogin($get, $post)

{

$uid = $get['uid'];

$username = $get['username'];

if(!api_synlogin)

{

return api_return_forbidden;

}

//note 同步登录 api 接口

header('p3p: cp=cura adma deva psao psdo our bus uni pur int dem sta pre com nav otc noi dsp cor');

$result = $this->db->getone(select mid,pwd from `dede_member` where `userid` like '$username' and matt<>10);

if(is_array($result))

{

include_once dedeinc.'/memberlogin.class.php';

$cfg_ml = new memberlogin(86400);

$cfg_ml->putlogininfo($result['mid']);

}

else

{

//如果没有激活,则自动添加该用户到数据库,并设置已激活状态的cookie

//会员的默认金币

$dfscores = 0;

$dfmoney = 0;

$dfrank = $this->db->getone(select money,scores from `dede_arcrank` where rank='10' );

if(is_array($dfrank))

{

$dfmoney = $dfrank['money'];

$dfscores = $dfrank['scores'];

}

$jointime = time();

$logintime = time();

$joinip = $get['regip'];

$loginip = $get['regip'];

$pwd = $get['password'];

$spacesta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0);

$mtype='个人';

$email=$get['email'];

$inquery = insert into `dede_member` (`mtype` ,`userid` ,`pwd` ,`uname` ,`sex` ,`rank` ,`money` ,`email` ,`scores` ,

`matt`, `spacesta` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip` )

values ('$mtype','$username','$pwd','$username','保密','10','$dfmoney','$email','$dfscores',

'0','$spacesta','','','','$jointime','$joinip','$logintime','$loginip'); ;

if($this->db->executenonequery($inquery))

{

$mid = $this->db->getlastid();

//写入默认会员详细资料

$space='person';

//写入默认统计数据

$membertjquery = insert into `dede_member_tj` (`mid`,`article`,`album`,`archives`,`homecount`,`pagecount`,`feedback`,`friend`,`stow`)

values ('$mid','0','0','0','0','0','0','0','0'); ;

$this->db->executenonequery($membertjquery);

//写入默认空间配置数据

$spacequery = insert into `dede_member_space`(`mid` ,`pagesize` ,`matt` ,`spacename` ,`spacelogo` ,`spacestyle`, `sign` ,`spacenews`)

values('$mid','10','0','$username的空间','','$space','',''); ;

$this->db->executenonequery($spacequery);

//写入其它默认数据

$this->db->executenonequery(insert into `dede_member_flink`(mid,title,url) values('$mid','织梦内容管理系统','http://www.dedecms.com'); );

include_once dedeinc.'/membermodel.cls.php';

$membermodel = new membermodel($mtype);

$modid=$membermodel->modid;

$modelform = $this->db->getone(select * from dede_member_model where id='$modid' );

$this->db->executenonequery(insert into `{$membermodel->table}` (`mid`) values ('$mid'););

//----------------------------------------------

//模拟登录

//---------------------------

include_once dedeinc.'/memberlogin.class.php';

$cfg_ml = new memberlogin(7*3600);

$cfg_ml->putlogininfo($mid);

}

}

}

function synlogout($get, $post)

{

if(!api_synlogout)

{

return api_return_forbidden;

}

//note 同步登出 api 接口

header('p3p: cp=cura adma deva psao psdo our bus uni pur int dem sta pre com nav otc noi dsp cor');

include_once dedeinc.'/memberlogin.class.php';

$cfg_ml = new memberlogin();

$cfg_ml->exitcookie();

}

function updatepw($get, $post)

{

if(!api_updatepw)

{

return api_return_forbidden;

}

$username = $get['username'];

$password = $get['password'];

//note 修改密码 api 接口

$newpw = md5($password);

$this->db->executenonequery(update `dede_member` set `pwd`='$newpw' where `userid`='$username');

return api_return_succeed;

}

function updatebadwords($get, $post)

{

if(!api_updatebadwords)

{

return api_return_forbidden;

}

$row = $this->db->getone(select `value` from `dede_sysconfig` where `varname`='cfg_replacestr');

$badwords = isset($row['value']) ? explode(,, $row['value']) : array();

if(is_array($post))

{

foreach($post as $k => $v)

{

if(in_array($v['find'],$badwords)) continue;

$badwords[] = $v['find'];

}

}

$badwords_comma = !empty($badwords) ? implode(,, $badwords) : '';

$this->db->executenonequery(update `dede_sysconfig` set `value`='$badwords_comma' where `varname`='cfg_replacestr');

$cachefile = dededata.'/config.cache.inc.php';

if(!is_writeable($cachefile))

{

return api_return_forbidden;

}

$fp = fopen($cachefile, 'w');

$this->db->setquery(select `varname`,`type`,`value`,`groupid` from `dede_sysconfig` order by aid asc );

$this->db->execute();

$s = '<?php'.rn;

while($row = $this->db->getarray())

{

$s .= '$'.$row['varname'].' = '.($row['type']=='number' ? $row['value'] : '.str_replace(','',$row['value']).').;rn;

}

$s .= '?>';

fwrite($fp, $s);

fclose($fp);

return api_return_succeed;

}

function updatehosts($get, $post)

{

if(!api_updatehosts)

{

return api_return_forbidden;

}

//note 理新host缓存 api 接口

$cachefile = uc_client_root.'/data/cache/hosts.php';

$fp = fopen($cachefile, 'w');

$s = <?phprn;

$s .= '$_cache['hosts'] = '.var_export($post, true).;rn;

fwrite($fp, $s);

fclose($fp);

return api_return_succeed;

}

function updateapps($get, $post)

{

if(!api_updateapps)

{

return api_return_forbidden;

}

$uc_api = $post['uc_api'];

//note 写 app 缓存文件

$cachefile = uc_client_root.'/data/cache/apps.php';

$fp = fopen($cachefile, 'w');

$s = <?phprn;

$s .= '$_cache['apps'] = '.var_export($post, true).;rn;

fwrite($fp, $s);

fclose($fp);

return api_return_succeed;

}

function updateclient($get, $post)

{

if(!api_updateclient)

{

return api_return_forbidden;

}

$cachefile = uc_client_root.'/data/cache/settings.php';

$fp = fopen($cachefile, 'w');

$s = '<?php'.rn;

$s .= '$_cache['settings'] = '.var_export($post, true).;rn;

fwrite($fp, $s);

fclose($fp);

return api_return_succeed;

}

function updatecredit($get, $post)

{

if(!api_updatecredit)

{

return api_return_forbidden;

}

/*

note 更新积分

discuz 默认8个积分表达,而dedecms只有一个积分字段,scores.注意money不能做积分来用.

extcredits1 extcredits2 extcredits3 extcredits4 extcredits5 extcredits6 extcredits7 extcredits8

*/

$credit = intval($get['credit']);

$fileds = $credit > 1 ? 'money' : 'scores';

$amount = $get['amount'];

$uid = $get['uid'];

include uc_client_root.'/client.php';

$data = uc_get_user($uid,1);

$username = $data[1];

$result = $this->db->getone(select mid from `dede_member` where userid='$username');

if(is_array($result))

{

$this->db->executenonequery(update `dede_member` set `$fileds`=`$fileds`+'$amount' where mid='$result[mid]');

}

return api_return_succeed;

}

function getcredit($get, $post)

{

if(!api_getcredit)

{

return api_return_forbidden;

}

include uc_client_root.'/client.php';

$data = uc_get_user($uid,1);

$username = $data[1];

$credit = intval($get['credit']);

$fileds = $credit > 1 ? 'money' : 'scores';

$result = $this->db->getone(select `$fileds` as credit from `dede_member` where userid='$username');

echo is_array($result) ? $result['credit'] : 0;

}

function getcreditsettings($get, $post)

{

if(!api_getcreditsettings)

{

return api_return_forbidden;

}

//这里支持dedecms积分,金币设置

$credits[1] = array(strip_tags('积分'), '分');

$credits[2] = array(strip_tags('金币'), '枚');

return $this->_serialize($credits);

}

function updatecreditsettings($get, $post)

{

if(!api_updatecreditsettings)

{

return api_return_forbidden;

}

$credit = $get['credit'];

$outextcredits = array();

if($credit && is_array($credit)) {

foreach($credit as $appid => $credititems) {

foreach($credititems as $value) {

if($value['appiddesc']!=uc_appid) continue;

$outextcredits[$appid][] = array(

'appiddesc' => $value['appiddesc'],

'creditdesc' => $value['creditdesc'],

'creditsrc' => $value['creditsrc'],

'title' => $value['title'],

'unit' => $value['unit'],

'ratiosrc' => $value['ratiosrc'],

'ratiodesc' => $value['ratiodesc'],

'ratio' => $value['ratio']

);

}

}

}

$_cache = <?php !defined('uc_api') && exit(403 forbidden!);n.'$_cache['credit'] = unserialize('.addslashes(serialize($outextcredits)).');'.rn.'?>';

$fp = @fopen(dededata.'/credits.inc.php', 'w');

@fwrite($fp, $_cache);

@fclose($fp);

return api_return_succeed;

}

}

function _authcode($string, $operation = 'decode', $key = '', $expiry = 0) {

$ckey_length = 4;

$key = md5($key ? $key : uc_key);

$keya = md5(substr($key, 0, 16));

$keyb = md5(substr($key, 16, 16));

$keyc = $ckey_length ? ($operation == 'decode' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';

$cryptkey = $keya.md5($keya.$keyc);

$key_length = strlen($cryptkey);

$string = $operation == 'decode' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;

$string_length = strlen($string);

$result = '';

$box = range(0, 255);

$rndkey = array();

for($i = 0; $i <= 255; $i++) {

$rndkey[$i] = ord($cryptkey[$i % $key_length]);

}

for($j = $i = 0; $i < 256; $i++) {

$j = ($j + $box[$i] + $rndkey[$i]) % 256;

$tmp = $box[$i];

$box[$i] = $box[$j];

$box[$j] = $tmp;

}

for($a = $j = $i = 0; $i < $string_length; $i++) {

$a = ($a + 1) % 256;

$j = ($j + $box[$a]) % 256;

$tmp = $box[$a];

$box[$a] = $box[$j];

$box[$j] = $tmp;

$result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));

}

if($operation == 'decode') {

if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {

return substr($result, 26);

} else {

return '';

}

} else {

return $keyc.str_replace('=', '', base64_encode($result));

}

}

function _stripslashes($string) {

if(is_array($string)) {

foreach($string as $key => $val) {

$string[$key] = _stripslashes($val);

}

} else {

$string = stripslashes($string);

}

return $string;

}

?>

中国足彩网信息请查看CMS教程
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!

2025国考·省考课程试听报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65099533/13759567129 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标