腾讯云网站解决方案帮您轻松应对建站成本高/网络不稳等常见问题

dedecms注册的会员自动激活discuz论坛

1
回复
1123
查看
[复制链接]

763

主题

777

帖子

3万

积分

董事

Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72Rank: 72

积分
32938
发表于 19-4-26 21:18:01 | 显示全部楼层 |阅读模式      紫钻仅向指定用户开放  
                dedecms整合discuz同步登录与退出并且不用激活! _) Y) Y3 t* G: M: e/ g/ G

6 z/ ~( K# C# \" b, s/ [    弄了一天,问题总算解决了,不过有点投机取巧,下面说下dedecms整合discuz后会员注册后不用激活的实现,以前做站时,一直在想,dede和 dz整合后,会员在网站注册后到论坛能不能不再激活,看着可不舒服,现在总算解决了,闲话不说了,下面进入正题,百度也不让发附件,只有啰嗦点了,呵呵, 比较长,分3篇:) K3 ~7 M( s& k, j8 R4 i7 s& n
1.首先找到dede-〉api-〉uc.php文件; y* N  W9 e6 W5 X" z% A
打开uc.php,将内容替换为:
7 S7 K$ |& e8 d9 ^: B+ e<?php4 I& s( `. @% K* s0 ?, D
/**************************二次开发说明**************************************
: e7 M) W9 V) Z& u  N9 W
此模块应用于DEDECMS5.6版本,请替换API文件夹的UC.PHP,替换后,通过DEDE注册的用户,7 X+ e: k+ k8 k( F0 G$ z+ H
访问论坛系统可以免激活,实现同时登陆同时退出。
) B4 U. Z9 @/ D; W; D*****************************************版权:
http://www.zzjie.com**************/
* q' u- q' W; W4 ]7 |include_once (dirname(__FILE__)."/../include/common.inc.php");
+ w, i5 H- g/ \2 ?1 t' `! qdefine('IN_DISCUZ', FALSE);

* l! o. O1 X* P8 {2 J  ^define('UC_CLIENT_VERSION', '1.5.0'); //note UCenter 版本标识: ]7 @: L9 ]2 K! S; Q9 U1 S9 Y
define('UC_CLIENT_RELEASE', '20081031');

1 _* G' @$ n4 Y4 t4 Qdefine('API_DELETEUSER', 1);   //note 用户删除 API 接口开关3 d8 Q: g: b2 x& m3 F2 u0 [
define('API_RENAMEUSER', 1);   //note 用户改名 API 接口开关( P% {3 t$ c: ~0 \
define('API_GETTAG', 1);   //note 获取标签 API 接口开关* N( ~8 x( k2 f9 A! N
define('API_SYNLOGIN', 1);   //note 同步登录 API 接口开关3 D; ^! v0 F/ i  ?3 q
define('API_SYNLOGOUT', 1);   //note 同步登出 API 接口开关
$ F: M3 e# t( S8 B! x, ~define('API_UPDATEPW', 1);   //note 更改用户密码 开关6 S0 _, B& R; J) H" R
define('API_UPDATEBADWORDS', 1); //note 更新关键字列表 开关) P/ D* P: @8 r2 c! i  f; o! F
define('API_UPDATEHOSTS', 1);   //note 更新域名解析缓存 开关
& T( Z* u" m/ P6 @; Ydefine('API_UPDATEAPPS', 1);   //note 更新应用列表 开关) M) }5 R' J3 p5 \; J$ G- c) l
define('API_UPDATECLIENT', 1);   //note 更新客户端缓存 开关$ @9 c" G( n8 a/ F4 j
define('API_UPDATECREDIT', 1);   //note 更新用户积分 开关) k! T7 L* ^3 R# F/ T& [
define('API_GETCREDITSETTINGS', 1); //note 向 UCenter 提供积分设置 开关
$ \& i4 t$ b- {define('API_GETCREDIT', 1);   //note 获取用户的某项积分 开关
: X+ t' ]+ D$ z5 N/ q' Z  zdefine('API_UPDATECREDITSETTINGS', 1); //note 更新应用积分设置 开关

$ l5 |1 l  {2 ]- t7 u. Y, \0 Wdefine('API_RETURN_SUCCEED', '1');
( j& d5 Q! W3 P- {define('API_RETURN_FAILED', '-1');" `0 ^9 z8 F/ @! M  X$ ~# Z; Z2 P
define('API_RETURN_FORBIDDEN', '-2');

* h; {/ c, b" X$ F- {: cdefine('UC_CLIENT_ROOT', DEDEROOT.'/uc_client');
2 J  X9 d- ?8 x//note 普通的 http 通知方式$ r, g' X: r; M& w: q' ]9 E' E
if(!defined('IN_UC'))
+ \  X8 }) ?0 t+ P' Y; y' w( g{
& a' R+ g! [7 [# M/ v, T  D
error_reporting(0);
) {8 P$ y3 ?9 a3 r3 _; Kset_magic_quotes_runtime(0);
5 r) Q3 y0 l( @$ I8 z& l8 ~+ Ydefined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());

- @* i6 H- |, Y: e2 A$_DCACHE = $get = $post = array();
8 ^6 r) Q4 M) A/ u% `( j6 D7 ?$code = @$_GET['code'];
! @8 O) }, c" Y- ]" M+ w4 `parse_str(_authcode($code, 'DECODE', UC_KEY), $get);
. }( H4 T8 `* r; }8 u2 ]) `3 J6 B6 r9 @' F) `
if(MAGIC_QUOTES_GPC). p# q4 ~( ]* J1 I
{
1 x. X2 i; T5 d' @+ |8 w   $get = _stripslashes($get);
7 `" d- V8 @9 e- |2 F7 B}

* B$ g/ R( {2 e5 C; _( K* u  Q$timestamp = time();
2 W/ f# d2 k) C+ oif($timestamp - $get['time'] > 3600) {) p& h& }: S5 w  j+ `. h. O
   exit('Authracation has expiried');9 |* f/ q( e& _
}
' c/ _' ~' f6 U9 F; T7 aif(empty($get)) {
+ [* v2 W0 f+ B   exit('Invalid Request');
) K! q% r4 R9 a; L$ {$ R' {5 ~3 N}1 L7 b$ h/ Z' s6 c, ~! V& i
$action = $get['action'];
7 @4 j) ]7 L0 R: ~  q5 V0 S
require_once UC_CLIENT_ROOT.'/lib/xml.class.php';
6 ?- [- \- v! T# q9 L$ z% T8 k$post = xml_unserialize(file_get_contents('php://input'));

+ J- R7 X/ M/ eif(in_array($get['action'], array('test',  'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout',  'updatepw', 'updatebadwords', 'updatehosts', 'updateapps',  'updateclient', 'updatecredit', 'getcreditsettings',  'updatecreditsettings')))8 H. @+ Z4 ?! f3 Q3 i
{
! r1 m+ E3 T1 D9 p2 i   $uc_note = new uc_note();4 x  I+ y0 ^3 e5 O
   exit($uc_note->$get['action']($get, $post));
$ k* X2 ~' g' A( y: _}else{( m7 r8 {* n) l2 z1 A* r
   exit(API_RETURN_FAILED);
$ C; U2 B! W. |4 O. L}
) X( ~6 D& B9 t
//note include 通知方式( |! Q8 J2 w. r- k4 H; \
} else {
4 [" C. O  `3 s% l' P
exit('Invalid Request');
2 [3 ^/ y8 I' {: `: ]. j}

% ^$ [: K$ |7 [$ E4 n7 M7 O) |class uc_note) |/ s6 r! j: r0 }
{

1 r4 j5 P: {" r5 o+ Lvar $dbconfig = '';
( n+ A% f% m3 P# Ivar $db = '';! y4 l  L3 u! {; S
var $appdir = '';: V! _" G5 g3 V0 k2 z
var $tablepre = 'dede_';, T& d; w5 @8 B- @- i( s

5 u( G% A4 e# x2 Jfunction _serialize($arr, $htmlon = 0)
4 A- W% l4 M+ {; N4 h8 _8 J6 [{$ R" u- m9 L7 Q) y& w: w) C, G  o5 |
   if(!function_exists('xml_serialize'))
' K1 K. Q5 `2 i   {
# A, G8 j8 J1 v" i3 @# a  M1 K    include_once UC_CLIENT_ROOT.'/lib/xml.class.php';
; X) z( n, R( K" p   }, H# \' s. |5 k4 T$ |# z
   return xml_serialize($arr, $htmlon);4 e* C' |1 r0 E; X8 A0 q
}
$ }* i6 l' k0 ?& B( x# b
function uc_note()
9 f  M) X& n* H1 ^{- Y2 B8 y9 i8 D5 ]* |
   $this->appdir = DEDEROOT;/ k6 l0 Q: i4 n
   $this->dbconfig = DEDEINC.'/common.inc.php';
3 i; v' C' X8 X* X   $this->db = $GLOBALS['dsql'];
% R2 t4 d% {3 N5 R' X   $this->tablepre = $GLOBALS['cfg_dbprefix'];
0 i& X/ n, Y) c7 s  _8 S! u}  }1 d% }& V. P7 _

& Q% ~; ?. F* w6 w  ?/ Zfunction get_uids($uids), Y1 Y4 E1 n- w# S2 E
{* n$ s/ ^5 P5 P0 A$ V3 N+ f
   include UC_CLIENT_ROOT.'/client.php';* G+ g7 F0 O6 Y/ r, ]/ F
  8 J9 I) r3 K3 S( T. R- C0 {# k+ K
   $members = explode(",", $uids);
' C8 ]; f) y$ F  K+ n/ J6 R   empty($members) && exit(API_RETURN_FORBIDDEN);
( X, L4 z2 g* N% u* G3 X8 \  
/ k- z* n! a0 S+ W6 i2 M' ~   /*$members_username = array();
4 o0 Q$ w' O3 q; e" g  1 e( d6 \) P9 I, o7 j, o; v
   foreach($members as $id): e# C3 Q/ a4 o
   {! U4 x; _. l4 ]
    $row = uc_get_user($id,1);8 h( T" U+ G1 l6 T! }: @& {  r- N
    $members_username[] = $row[1];  7 Q# t- @% S; w9 S
   }5 K3 X. n. P9 p  `  t! b+ Y- e1 s
  
8 b3 N. t8 x. a1 e. s8 f   $comma_temps = implode(",", $members_username);
5 z2 S5 [) c8 ^- S& W  ; u. D: w" V& _( I1 p
   empty($comma_temps) && exit(API_RETURN_FORBIDDEN);
" r" _0 T2 n6 [# R  
6 ^2 l" y" p( F; Y   $comma_uids = array();*/& `; m7 K, @8 F9 T
  $ z  `& c) B. E
   //$row = $this->db->SetQuery("SELECT mid FROM
`dede_member` WHERE userid IN ($comma_temps)");* f" w& p3 `% H
  
, H" y/ U, d, z' N8 }5 b   $this->db->SetQuery("SELECT mid FROM
`dede_member` WHERE mid IN ($uids)");
  A7 D; @1 t1 B( S   $this->db->Execute();  
, c, L2 I+ H: [2 C$ Q, x   while($row = $this->db->GetArray())
# r2 R8 T! u  m& ~   {
2 y! V$ ~4 M& y9 y9 ~. n    $comma_uids[] = $row['mid'];0 S9 I/ Q+ q3 W
   }
+ ?0 v& J) S8 n+ D) b  E/ n! [+ u  
8 e! x( f' I. }: `   empty($comma_uids) && exit(API_RETURN_FORBIDDEN);
$ K8 t; l& ?2 e5 b  
7 Y* L) ^; I- d) _" K  e# t; u   return implode(",", $comma_uids);
; W' ?; p7 w6 g& |9 e$ T}

* i8 g4 ?9 w0 u$ r/ }1 u/ i3 Ufunction test($get, $post)% [* M( j6 A0 {$ [
{0 |, W: F+ R! ~& K2 V- {$ n! M9 k
   return API_RETURN_SUCCEED;- q6 e% i) Z7 I  A6 z
}

5 }& C1 I& y# G( b3 rfunction deleteuser($get, $post)
- \  k2 d6 N: _6 t- d{1 p9 l- ^7 B; L( U
   $uids = $this->get_uids($get['ids']);9 k! a) E$ G- ?0 H5 o
   !API_DELETEUSER && exit(API_RETURN_FORBIDDEN);
9 n1 ?* Q6 N( Z/ R) K
   //note 用户删除 API 接口2 R: E8 Q1 M7 ], i
   $rs = $this->db->ExecuteNoneQuery2("DELETE FROM
`dede_member` WHERE mid IN ($uids) AND matt<>10 limit 1");
% \- K, S- ]8 `; a0 Q4 j' a7 {$ G( ^" a   if($rs > 0)) g* j. N! j* I5 s
   {
: C7 j+ Q% I* x    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_tj` WHERE mid IN ($uids) limit 1");
" {" r7 s+ S7 |% p    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_space` WHERE mid IN ($uids) limit 1");) y" U( H  C, B. u, ]% l
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_company` WHERE mid IN ($uids) limit 1");
& q! i$ N/ C9 c8 j6 H    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_person` WHERE mid IN ($uids) limit 1");! D4 k+ T6 F+ m+ }: T
  . G+ S! Z0 x& h" s) i
    //删除用户相关数据
0 }1 F$ r! \$ {. _- P/ o    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_stow` WHERE mid IN ($uids) ");
: J% @- ~. F) b    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_flink` WHERE mid IN ($uids) ");
9 r( X! j) C/ x" h- C    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_guestbook` WHERE mid IN ($uids) ");
" d  @5 D# Z1 k    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_operation` WHERE mid IN ($uids) ");
: @& q' i- g2 Z! P    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_pms` WHERE toid IN ($uids) OR fromid IN ($uids) ");. O5 ?$ m' x# l) ^& z
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_friends` WHERE mid IN ($uids) OR fid IN ($uids) ");
8 n$ x7 @, g0 e8 @. q    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_vhistory` WHERE mid IN ($uids) OR vid IN ($uids) ");  l: C0 Z$ D3 _8 R
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_feedback` WHERE mid IN ($uids) ");
9 ^/ L5 T9 e0 M/ w    $this->db->ExecuteNoneQuery("UPDATE
`dede_archives` SET mid='0' WHERE mid IN ($uids)");6 o+ G$ e. A* m; y: ?
   }- ^) u2 J0 @% z! n4 g. U
   else
6 E0 x, ]" k8 V8 T   {% q- W  c# {4 P% ~9 V
    exit(API_RETURN_FORBIDDEN);
# e" Z! d/ `% ~$ t/ U! {   }

0 S$ Q4 o! R# Q* y' ]3 T" ?4 x   return API_RETURN_SUCCEED;3 s) z2 H5 k0 r" B* [
}
! F- b" ?+ |% ~5 G, b& w
function renameuser($get, $post)
9 A. G! A* P) w+ L! b) d# W{7 E- H8 R% W8 n
   $uids = $this->get_uids($get['ids']);
* D6 v. y8 l( K9 S; G0 \  * \, W6 U' ^" M
  ' w; ?# R/ t" F
   $usernameold = $get['oldusername'];5 `. n7 u" j9 D! p( D
   $usernamenew = $get['newusername'];
) q9 N/ p1 S4 [3 K( `/ y   if(!API_RENAMEUSER)
' F" f7 K" \  D# O   {
& I! N# Q; Q5 A  V7 m    return API_RETURN_FORBIDDEN;% L  D7 y9 E  y6 T# y( \% x8 a
   }

( P# W  {, }/ y' U$ g( X   //note 获取标签 API 接口7 l, P+ [1 M$ o" ~4 o
   $rs = $this->db->ExecuteNoneQuery2("UPDATE
`dede_member` SET userid='$usernamenew' WHERE userid='$usernamenew' AND matt<>10 limit 1");4 w  d2 z; [+ [
   if($rs > 0)
! o4 D4 t) d8 r. Y6 n: S   {
# v/ B" S. I0 q' ?    $this->db->ExecuteNoneQuery("UPDATE
`dede_archives` SET writer='$usernamenew' WHERE writer='$usernamenew'");+ v) k+ x0 |) K$ K
    $this->db->ExecuteNoneQuery("UPDATE
`dede_member_pms`  SET floginid=REPLACE(floginid, 't$usernameold',  't$usernamenew'),tologinid=REPLACE(tologinid, 't$usernameold',  't$usernamenew')");& S# E: T0 r0 |* y3 m; _
   
( I  A' E1 x# \$ `6 Y/ a   ' x& K! B; a9 w
    $row = $this->db->GetOne("SHOW TABLE STATUS");4 Z! w; _$ @8 q$ z
    $db_tables = $row['Name']; unset($row);! b  Y. G$ w/ t! V( ]4 K- K8 B( c3 {& b" R
   . X1 n/ [- t7 `; e. b9 e
    if(in_array($this->tablepre.'guestbook',$db_tables))* y* W7 Z) {! o6 E0 h' p
    {
7 S: Q  {& j: V# `     $this->db->ExecuteNoneQuery("UPDATE
`dede_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");8 n- B8 f  U% m: m
    }. `' V& {9 c, o. T& {9 h0 ~; H
   5 n/ H# h2 I8 e0 b# d* H$ z! s3 F
    if(in_array($this->tablepre.'story_books',$db_tables))  W8 G2 K4 F& u7 F! m5 @
    {
* I6 m' ~, c9 m4 q0 M     $this->db->ExecuteNoneQuery("UPDATE
`dede_story_books` SET author='$usernamenew' WHERE author='$usernamenew'");
2 s. n$ H! S4 C  _    }5 M. q+ L  {. b4 f# d  ^
   
( B7 F  u7 h& {) I' l. I; I    if(in_array($this->tablepre.'groups',$db_tables))  E" H) K1 e) T7 ^
    {
8 E  w: ^' I3 R7 C$ Z     $this->db->ExecuteNoneQuery("UPDATE
`dede_groups` SET creater='$usernamenew' WHERE creater='$usernamenew'");
) W% ^+ V3 Y# P5 i     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_threads` SET author='$usernamenew' WHERE author='$usernamenew'");9 c# w. @5 M% |& U$ C# N4 F$ H7 D5 D$ o
     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_user` SET username='$usernamenew' WHERE username='$usernamenew'");, a% D$ D" y: _
     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_posts` SET author='$usernamenew' WHERE author='$usernamenew'");: `3 y( U. a3 L# b8 S1 W0 |: X3 M
     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");
* `. G5 C( c! M0 w& n     $this->db->ExecuteNoneQuery("UPDATE
`dede_groups` SET ismaster=REPLACE(ismaster, 't$usernameold', 't$usernamenew')");
( M4 S8 T* k+ O3 V    }
* U7 G/ `+ Y  ?   . i9 d4 x: {7 ]& Q
    return API_RETURN_SUCCEED;6 T/ i( ?7 h! Q0 D9 J& B% [
   }
, V) N$ i9 L# r: b# f6 A, K* ?   else' o8 S; y4 b' {* M4 f+ }
   {
( k3 f5 S% Y" V" L9 h' E# \7 C    return API_RETURN_FORBIDDEN;
0 U' e1 E  Q% Y  |+ r% C   }: h  e1 J& Y# v. v' s- d( b/ z
}
( z( ]. a9 ]" i
function gettag($get, $post)
/ `' N% s& H/ i% E% O; `& ]{
  Q  X! a* q" B6 r( e   $name = $get['id'];- d( l$ Q1 o7 k  a0 {9 A
   if(!API_GETTAG)
* O) V7 Z+ V. J! h/ O) ~3 z   {. n; K, ?4 _. D" z
    return API_RETURN_FORBIDDEN;% Q- s" t. w6 g3 v( R) G
   }

# X1 U( s8 x1 ?3 t- l/ b   //note 获取标签 API 接口
  M! n! d  U4 @# c   $name = trim($name);" E: j& W) Q* W) F7 @2 i
   if(empty($name) || !preg_match('/^([x7f-xff_-]|w|s)+$/', $name) || strlen($name) > 20)( l. `8 f+ ]8 @/ o8 E
   {! U) I! d; E) V' s) n9 e; [8 D6 J& W, i
    return API_RETURN_FAILED;+ `7 H2 K* G* f4 D7 ~0 |) L1 i* M7 u
   }

7 `1 M! L+ t$ Y( Z  Q) v- `   $row = $this->db->GetOne("SELECT `total`,`id` FROM `dede_tagindex` WHERE `tag`='$name'");
8 Z& A) \0 b7 f# ?$ F$ e   if(!is_array($row))- B( G, @' F9 h3 G) d: ]/ j
   {
3 E3 f0 C* i% v" k' K# I* x    return API_RETURN_FAILED;
* ?: k5 S( L/ q  K& a# R/ e   }9 |3 L3 k0 l" y1 M+ h6 r
  6 e. s/ r4 S7 i  f) W: f
   $tpp = $row['total'] > 10 ? 10 : $row['total'];  ) t' X6 V1 Y( u$ I" e# h% p- w0 ]
  8 z2 ?$ r7 `6 I" E
   $ids = array();' h3 P/ o% w6 u% P" N& U
  
8 }) L  V5 w6 E8 z- v   $this->db->SetQuery("SELECT aid FROM
`dede_taglist` WHERE `tid`='$row[id]' AND arcrank>-1");
2 x" B. F: Q; c2 i   $this->db->Execute();
1 h) ~, V! Y1 u+ P5 W( _# ]0 i& f   while($row = $this->db->GetArray())2 g/ W+ f" k  D1 |+ h2 c+ W
   {
. _7 v( w, |4 }4 n8 \8 K# `    $ids[] = $row['aid'];   
9 f$ {" }' m" v/ d5 w9 X- r) F   }
: Z8 B& w9 |" Q. B  
, I8 J5 ]2 x' W" m% O7 g7 T1 z   if(empty($ids))
9 M1 ?- b0 X2 e, k2 z   {( b/ g& f6 V8 m, c- {3 s
    return API_RETURN_FAILED;
3 U" U, [% f# V* S9 G( J   }- W$ M3 {3 J* v
  , Y! J3 r, k3 |5 B  V2 J+ F, j. Q
   $aids = implode(",", $ids);+ S; ^7 k. Z- B# c* F/ N% }
  ( S2 [+ p4 s- h4 y0 x$ i3 J
   include_once DEDEINC.'/channelunit.func.php';; R$ d8 L5 K  N) J
  $ s+ @6 W! \2 U+ L: n1 r
   $archives_list = array();  : i# O- i: E7 j. D+ A) Y
   $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  
: s. _5 }3 q7 M- z- J" YFROM
`dede_archives` arc LEFT JOIN `dede_arctype` tp ON arc.typeid=tp.id WHERE arc.id IN($aids) ORDER BY id DESC LIMIT $tpp");- ^7 b1 S0 w3 G' Q
   $this->db->Execute();9 d3 k3 p& i# B2 Q) [
   while($row = $this->db->GetArray())
$ G9 h. J1 {. |   {0 X  s# [( `0 Q; Y1 c# K* m
    $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']);
, T$ l# `3 H4 I3 v: I( y2 a) a; f
    $row['url'] = !ereg('http:',$row['url']) ? $GLOBALS['cfg_basehost'].$row['url'] : $row['url'];
7 x. D/ I7 L5 M' y  H+ m   
( Y4 m7 c6 g5 k, i8 \$ n/ g    if(!empty($row['url'])). j3 R! _* r& U& M; X( H0 G2 y
    {
$ q8 \& q# T# Q6 d* J     $archives_list[] = array('title' => $row['title'],'writer' =>  $row['writer'],'pubdate' => $row['pubdate'],'url' =>  $row['url']);
: w. \' J0 S( |6 m5 [+ z+ C  T; y    }
+ o& t9 r# s+ e8 ?0 m9 O   }

) l8 O3 v5 L7 e   $return = array($name, $archives_list);
, {# I/ A! a( g& A  i! c   return $this->_serialize($return, 1);! N  V: @% n2 ]+ k( B3 R& o- T" w
}
6 _+ T5 R/ C7 D  ~: ^# L! a
function synlogin($get, $post)3 @% t( V4 F. J5 e
{; S1 \0 e( T* }+ S; p) O. ^" `, W
   $uid = $get['uid'];6 P: B6 \! o' Z! I) L7 \5 T  W
   $username = $get['username'];' k( H3 @, Z  s5 B  s3 d6 ]% x
   if(!API_SYNLOGIN)
2 w9 Y- N6 T2 G, E, J" q7 ^( D   {
; U, r6 Q0 U. G% ^    return API_RETURN_FORBIDDEN;: p7 @0 A4 f  R) t- M) m0 ~, e8 U; P/ z
   }
1 \- g- A; m/ W$ x, A, B
   //note 同步登录 API 接口
/ f4 T5 v. a1 h$ h$ L$ ^2 f, I   header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
' J& A! ~# u4 S8 T   $result = $this->db->GetOne("SELECT mid,pwd FROM
`dede_member` WHERE `userid` like '$username' AND matt<>10");
% J" e1 [' v7 l! }   if(is_array($result))0 }8 Y+ F  E/ C& s
   {
+ u* N3 F/ d6 ~( k3 P    include_once DEDEINC.'/memberlogin.class.php';
+ W1 y4 X! N/ C8 A) @- e    $cfg_ml = new MemberLogin(86400);
( h! ~; @# V9 `    $cfg_ml->PutLoginInfo($result['mid']);- [. F2 a* D- i; b7 }. [/ @8 W
   }, w' q! _. {, C! z4 ^
   else
1 n5 J% @" M1 o4 [8 u   {   
0 v% q: X0 e$ _  d9 i6 f    //如果没有激活,则自动添加该用户到数据库,并设置已激活状态的cookie0 O0 G  A1 m1 Q5 v5 U: R- |
    //会员的默认金币- }+ F+ f9 I# v2 O& ~
    $dfscores = 0;' j3 g9 s9 G6 H+ T" o6 M9 g: n
    $dfmoney = 0;
! f) o- R, F5 A& M) j+ n( _    $dfrank = $this->db->GetOne("Select money,scores From
`dede_arcrank` where rank='10' ");
- I& C7 U- ?( T. [0 ?2 K, d, k    if(is_array($dfrank))
* n3 K& j7 d+ @8 Q! \, C    {
4 d7 s  [) b: j     $dfmoney = $dfrank['money'];
% n/ \) X, V% k0 o7 N- A3 q- ^     $dfscores = $dfrank['scores'];1 \. L! k% d" I* D
    }9 `% H, _% q1 V$ ^9 m
    $jointime = time();
6 |) ?% @* U; ~5 w$ n. o6 y, q    $logintime = time();
  F* {8 x( m( n( R, a    $joinip = $get['regip'];4 h9 t5 ]! `2 v0 A4 G
    $loginip = $get['regip'];
+ R. r* m) h( O8 \, B" O% K. r    $pwd = $get['password'];
* B$ o1 O6 F. p* B3 w   
7 c" t& U/ Z2 k& Q    $spaceSta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0);
7 o" [; B/ G0 u% o6 y) z    $mtype='个人';' f% v: u. i6 a' b2 ?
    $email=$get['email'];! W$ C4 k  w; N/ q2 D
   % Q0 m5 Y) n2 x( U4 q
    $inQuery = "INSERT INTO
`dede_member` (`mtype` ,`userid` ,`pwd` ,`uname` ,`sex` ,`rank` ,`money` ,`email` ,`scores` ,
6 d$ @! ?; d5 J2 N& b& S    `matt`, `spacesta` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip` )
" q& c+ Y* Z- Y% H0 ]8 b* O     VALUES ('$mtype','$username','$pwd','$username','保密','10','$dfmoney','$email','$dfscores'," w, ]7 x( u( {
     '0','$spaceSta','','','','$jointime','$joinip','$logintime','$loginip'); ";
+ d+ w3 w2 S+ Y4 X   
+ N6 W* ?7 k# x, U7 h    if($this->db->ExecuteNoneQuery($inQuery))) K" \& B, _: g
    {   
2 V' Y* ^9 F0 X9 {: U+ a8 K* i     $mid = $this->db->GetLastID();
8 M: g5 W+ Q" b+ x* b2 o0 N+ C! z  ' k/ y4 z. m& P( P
     //写入默认会员详细资料
  A% D) P! e( O     $space='person';
4 {% c8 D, |6 R: d( S- l  4 `6 E( p/ \9 W( u7 M5 N
     //写入默认统计数据( i: w' d+ p9 z) d2 n2 v: H
     $membertjquery = "INSERT INTO
`dede_member_tj` (`mid`,`article`,`album`,`archives`,`homecount`,`pagecount`,`feedback`,`friend`,`stow`)  S8 `* t' J7 _) ^( {; T7 ^% x  A
                 VALUES ('$mid','0','0','0','0','0','0','0','0'); ";% h, \  A5 @7 ^6 R- Y! t- I
     $this->db->ExecuteNoneQuery($membertjquery);
0 i. F: y# e, k+ ~  
+ W* D/ R0 O' p; F     //写入默认空间配置数据8 i9 m; T" S$ V7 I/ j. g
     $spacequery = "Insert Into
`dede_member_space`(`mid` ,`pagesize` ,`matt` ,`spacename` ,`spacelogo` ,`spacestyle`, `sign` ,`spacenews`)4 x2 {' V& U0 I" Y8 y. O. @
               Values('$mid','10','0','$username的空间','','$space','',''); ";
( a/ h- {* g8 c* a     $this->db->ExecuteNoneQuery($spacequery);& k" q$ F* u2 Y1 H4 Z1 C& a# p
  
& y$ }# ]% e# I0 j8 }     //写入其它默认数据
8 B2 x6 v: f% R* M3 e) W; S2 D- A     $this->db->ExecuteNoneQuery("INSERT INTO
`dede_member_flink`(mid,title,url) VALUES('$mid','织梦内容管理系统','http://www.dedecms.com'); ");: @8 I9 |2 Z, y8 u
   
3 ^4 C" X7 w4 [+ U' i' G1 q     include_once DEDEINC.'/membermodel.cls.php';
/ a3 \4 Z7 X2 H1 H: V    ( L8 \( f& @2 Z3 b0 n  d
     $membermodel = new membermodel($mtype);
, H; B' f3 Z; v; t    # P0 C; n! |1 _. z; [$ V  G1 e
     $modid=$membermodel->modid;8 q/ a) W: v( ?" [/ S5 r* W: H
     
, C' w9 l& S7 |+ M  l- C2 g# u6 c- C     $modelform = $this->db->getOne("select * from
dede_member_model where id='$modid' ");
, x* C2 v& M* z; j' V    & D* n" E; v2 `9 \6 `5 h1 }
     $this->db->ExecuteNoneQuery("INSERT INTO `{$membermodel->table}` (`mid`) VALUES ('$mid');");  x1 f1 ~/ O5 H! W0 f2 ?
        . V* k) S* L- G, M3 l
     //----------------------------------------------
4 ~1 b; r2 I: Z& J6 Q     //模拟登录
7 d1 B9 w2 L+ o6 M% c     //---------------------------/ U! N$ F. d/ [* k1 D5 W
     include_once DEDEINC.'/memberlogin.class.php';
. Q  Z7 J- J3 u7 n     $cfg_ml = new MemberLogin(7*3600);
) A. p4 v; Q8 S2 r5 @$ s     $cfg_ml->PutLoginInfo($mid);   
" A/ t) _: @* F  c: e    7 q$ z9 l2 ~# e% }
    }6 S- i1 P( w4 \" N/ I" F" h  p
   : p* x- z# b4 w, J( i
   }
+ Z, Z8 w  v: m9 P& Y6 G: \" M8 m}

( V* o( S& ?. R5 @7 X8 @0 v6 zfunction synlogout($get, $post)9 J9 [6 b% w. K: N# n5 }
{( w3 G9 d- k7 C) e+ Y0 I8 y# Y+ G
   if(!API_SYNLOGOUT)
4 n$ I4 y3 }1 A6 ~; {2 e# \   {. w6 g& A9 s0 S6 {1 |  q# t
    return API_RETURN_FORBIDDEN;
/ W& G( ^9 g: ~1 A( `' f1 E% m   }

; A. H+ a9 F/ Y- P* X3 \& q) _   //note 同步登出 API 接口
' O  |: C4 q+ k* d% I   header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
9 q# ^3 ^* X  K4 a- N# g* Y8 a$ o   include_once DEDEINC.'/memberlogin.class.php';8 Z+ {2 L, V9 c! \+ ~1 W
   $cfg_ml = new MemberLogin();# C/ M4 J4 V' V+ N+ G9 U% D; |- z- z
   $cfg_ml->ExitCookie();8 S! a' d* C4 d# e& f
}

/ m; j8 J" L4 r" R8 [function updatepw($get, $post): v& ]( J- _7 y7 N! N2 V
{
6 J- x) l: z0 K8 Y: ~; A% Q   if(!API_UPDATEPW)
8 ~4 J$ h4 r) Z   {  M( S4 t# `; Y1 D" F
    return API_RETURN_FORBIDDEN;
! \8 ?, X! ]0 r  ?  I) @   }
6 p5 C% n* f  l& w, B& v   $username = $get['username'];3 Q% q7 E1 T- c  x" r
   $password = $get['password'];+ |) P) ?  ^: O: B
  
! z, L1 X7 H9 P   //note 修改密码 API 接口
+ B/ d( X. R! l; }) V! l   $newpw = md5($password);
  ]# s0 ~% N! R, L  n( ^; A- S   $this->db->ExecuteNoneQuery("UPDATE
`dede_member` SET `pwd`='$newpw' WHERE `userid`='$username'");' V7 e" g3 p( _
   return API_RETURN_SUCCEED;
6 P" F: O6 \8 c+ l, [; O( |4 c}
7 ]1 R( O" d3 S: x! _% O  K2 W& _
function updatebadwords($get, $post)6 k2 R9 G( [. W: M" B: h! `
{' r* Q, T( G2 S' g! Y+ k. N
   if(!API_UPDATEBADWORDS)
' t: y2 f* E! }3 R% B& e   {# h4 u, w( w: Z0 B! E
    return API_RETURN_FORBIDDEN;0 j/ b$ E- w' @6 D+ a. _: {
   }

* l6 e" L9 x% K2 X0 ~8 k) G   $row = $this->db->GetOne("SELECT `value` FROM `dede_sysconfig` WHERE `varname`='cfg_replacestr'");
$ K, [0 {! a, P1 f2 B) J  
* H) c5 m* Q, L6 Y! b, A+ p   $badwords = isset($row['value']) ? explode(",", $row['value']) : array();
6 E) ~4 U1 k6 E' K" f! R  
+ R8 s- w5 W# Z$ V( ~# k- z; T   if(is_array($post))
6 @& ~  Y/ f5 Y4 v4 d8 V) O   {
4 _7 U% E8 h( O    foreach($post as $k => $v)
% `2 [' E$ X$ O4 G( Y* C    {
) d2 n+ i  r+ [7 |6 b     if(in_array($v['find'],$badwords)) continue;
: ?) N+ G3 L0 M& U     $badwords[] = $v['find'];) T3 o8 r, S' P/ d
    }  k0 g6 x$ p6 N+ {
   }
! s; x* S2 y5 c7 E/ Z% P$ P
   $badwords_comma = !empty($badwords) ? implode(",", $badwords) : '';' t! G4 T2 Z- h% }3 D$ [
  
% z9 @1 d  t9 |1 @
   $this->db->ExecuteNoneQuery("UPDATE `dede_sysconfig` SET `value`='$badwords_comma' WHERE `varname`='cfg_replacestr'");
# t, N  a5 i1 M, Z9 H) Z) ?" D/ j1 f  
* u+ B, T4 T( x0 B   $cachefile = DEDEDATA.'/config.cache.inc.php';
7 ]8 s" b6 y( v, B0 ]  ) c  r1 z% Q- h  s5 I
   if(!is_writeable($cachefile))
$ A( ~" x- S0 {7 r   {( m9 k. n  c8 }, t8 U
    return API_RETURN_FORBIDDEN;/ }% e+ }! h; _  e7 W: y6 q
   }
- l/ Z) E* o( X4 c! H
   $fp = fopen($cachefile, 'w');. a& D% ~+ u1 q+ x9 d( u) c2 M
   $this->db->SetQuery("SELECT `varname`,`type`,`value`,`groupid` From
`dede_sysconfig` order by aid asc ");# y" w2 F9 D: C9 P( H
   $this->db->Execute();
. M2 M  j( V$ i# n   $s = '<?php'."rn";. m( ^7 \, B! E) ~- F5 {/ L
   while($row = $this->db->GetArray())3 X& o0 T5 m# q: Q$ e; ?7 m# F
   {
6 q; T7 q( {" I: \  @" \    $s .= '$'.$row['varname'].' = '.($row['type']=='number' ?  $row['value'] : "'".str_replace("'",'',$row['value'])."'").";rn";
; R; {" Z! h2 N' n   }
5 C5 C6 v8 ?( y, n   $s .= '?>';& T% C1 ?  _3 n' E8 M
   fwrite($fp, $s);2 M9 g8 H8 A/ k0 e
   fclose($fp);
( K3 B2 t5 Z; x! U) ]   return API_RETURN_SUCCEED;1 n; @* k4 {3 [) I7 f6 m; g- e
}
* e2 _) p; p5 G) ^; G
function updatehosts($get, $post)
) ?7 _% C' ?9 a{7 Y" S. F6 \7 _# `9 {  t" f" q
   if(!API_UPDATEHOSTS)! L+ h5 h/ F  C  l- u* g( T
   {; s! F& Y5 X1 _( h3 Q
    return API_RETURN_FORBIDDEN;
4 Y7 h# U0 m# @! C) `+ d, X7 \8 o% U7 o   }' }- T4 ?( _5 n+ c% v6 v. y: o
   //note 理新HOST缓存 API 接口
( |7 k0 s! e0 u( R: h" F+ r; N3 U8 B   $cachefile = UC_CLIENT_ROOT.'/data/cache/hosts.php';/ h" R" ~3 S/ A( |# f
   $fp = fopen($cachefile, 'w');6 Y( V% D: m9 z7 s% ^& g
   $s = "<?phprn";+ ]$ ?; G+ F! `8 I
   $s .= '$_CACHE['hosts'] = '.var_export($post, TRUE).";rn";7 s" m0 F, @. v* i+ p' P
   fwrite($fp, $s);% Z% \- r2 F8 c4 z3 J
   fclose($fp);
: [$ e" [' X$ |   return API_RETURN_SUCCEED;
' n+ h. R7 W; Z& t; ^) I/ o" [! G}

4 y: n. ~0 l2 @* S, r  hfunction updateapps($get, $post)1 R6 u6 X, L3 s  r
{
: s- U  i$ K6 v   if(!API_UPDATEAPPS)
- ~% C0 L3 Z  d4 P* j" ^7 ^% }   {
9 P( g- A5 t. a( T    return API_RETURN_FORBIDDEN;% K+ M! ?6 A4 X% v
   }
7 A0 M* C( ^- @2 ^' x$ _   $UC_API = $post['UC_API'];

5 q: ~6 H! Z" A   //note 写 app 缓存文件
; ^) a; X& g& g+ X   $cachefile = UC_CLIENT_ROOT.'/data/cache/apps.php';* Y: Y! f3 l5 P
   $fp = fopen($cachefile, 'w');
4 j1 f- W5 R9 n6 ~8 e   $s = "<?phprn";
: B! v. b1 t/ g: L# g   $s .= '$_CACHE['apps'] = '.var_export($post, TRUE).";rn";4 k) O. }& k* L% ]
   fwrite($fp, $s);
5 f' f. R# n  F0 C# m   fclose($fp);
# M: M' R* o. l- S; p* a6 |
   return API_RETURN_SUCCEED;
4 H) a8 s! J* ]}

3 d3 C) ~' h( D0 Y' xfunction updateclient($get, $post)
' W$ C# ~5 W( W7 p/ X  G. u{
$ S! m$ h: @% l8 g$ ~1 S8 t   if(!API_UPDATECLIENT)
# Z4 `& b/ a4 o$ W   {
# C" F; S& Z" K, ^. D9 C    return API_RETURN_FORBIDDEN;
" q% H! P, C" D7 G   }
5 _! _& P; f2 K! h9 ^   $cachefile = UC_CLIENT_ROOT.'/data/cache/settings.php';
8 t8 x" _# Z. G$ I5 N% I  a! |   $fp = fopen($cachefile, 'w');) ?# @* @: c0 D9 @* b
   $s = '<?php'."rn";
) v- z9 G' j6 N) B& H   $s .= '$_CACHE['settings'] = '.var_export($post, TRUE).";rn";
# `$ L4 J2 T' F3 j/ ^   fwrite($fp, $s);
% j- Z8 h7 _6 f   fclose($fp);9 z" T; U- k2 |, i) ?* M. E
  
# H' K  n8 W9 V) D# K3 b   return API_RETURN_SUCCEED;) p4 P* s' }; ]9 s2 D
}
- _9 m7 Q7 @3 ]! M2 v; V9 j
function updatecredit($get, $post)
  h7 s; A/ @8 H) \/ ]: i{, W! v" Z$ C1 b+ m; v
   if(!API_UPDATECREDIT): T( H; y/ L6 g' u0 X- Q
   {& S' q5 U5 T  s) K% I
    return API_RETURN_FORBIDDEN;
" g7 j5 I, f( k! E   }
. z& B4 ?. y4 N6 e5 C# n* S  X   /*
2 x: y* R- i. H1 R   note 更新积分
/ _4 P1 `: T6 e) N; K  C   discuz 默认8个积分表达,而DedeCMS只有一个积分字段,scores.注意money不能做积分来用.+ u. S. O: v3 m
   extcredits1 extcredits2 extcredits3 extcredits4 extcredits5 extcredits6 extcredits7 extcredits83 V' \! X2 b6 Q( y
   */+ A' q( h; D. o: v! A
   
) q* [8 Y9 V- _, J3 q/ j: A$ K8 @   $credit = intval($get['credit']);, s' G3 a- `% q( g1 X. d7 L
   $fileds = $credit > 1 ? 'money' : 'scores';
  q* L1 ?, b7 x" D6 {9 N   $amount = $get['amount'];3 x6 x5 E: C+ H: c
   $uid = $get['uid'];
% r8 M& G4 ?. r  j3 k   include UC_CLIENT_ROOT.'/client.php';  C" x0 x! T, _0 l* ~) s
   $data = uc_get_user($uid,1);2 `9 G' Y) P1 a
   $username = $data[1];( D# ^0 K: i" P& `* J
  + d2 D/ Y2 L3 p0 G) ]( W" R% j( }$ t
   $result = $this->db->GetOne("SELECT mid FROM
`dede_member` WHERE userid='$username'");
% E/ g$ C, G/ }   if(is_array($result))
; w) V5 }- b9 i0 `/ D0 \* O   {
6 Y' C% U( l( x  `* o/ D. l8 J1 ^    $this->db->ExecuteNoneQuery("UPDATE
`dede_member` SET `$fileds`=`$fileds`+'$amount' WHERE mid='$result[mid]'");
- y2 Q. ~6 P: `( ?3 m0 w   }6 F" @3 t3 k$ U/ f' a! ]
  0 I8 H$ h5 y1 @& f
   return API_RETURN_SUCCEED;
+ \; d- N2 k3 N9 C& F1 s! H) i}
  e5 D2 V1 E( g7 l+ n* P/ z! i, P
function getcredit($get, $post)' I; f8 L# P. t6 P1 o6 K4 H
{
3 L7 ]/ P0 }0 R   if(!API_GETCREDIT)
) J: M: \& ^5 y" X" z$ a5 R* y% ]- K6 ^   {- c; k; C8 k3 G0 s) ]; I7 s& Z
    return API_RETURN_FORBIDDEN;
- H- d9 V" q- q9 p" X$ r' F8 T   }
) }1 i3 v  O/ Z  : w5 [7 P2 O4 i( D  e! ?
   include UC_CLIENT_ROOT.'/client.php';. I+ J( H$ d' i2 G" ?
   $data = uc_get_user($uid,1);
* c4 S8 S9 ], w4 F/ O* D4 D( V5 C   $username = $data[1];
1 p# M7 `8 L' t9 P3 s# F   $credit = intval($get['credit']);- U/ {  T2 O) E( R% r+ O
   $fileds = $credit > 1 ? 'money' : 'scores';
- J9 }; L, K/ s   $result = $this->db->GetOne("SELECT `$fileds` AS credit FROM
`dede_member` WHERE userid='$username'");2 q, J0 O1 ?* g6 b5 F# i
  5 f$ h/ G: S( F; c! l! C4 Z0 m
   echo is_array($result) ? $result['credit'] : 0;  
! O! f2 n  ]8 Z& U2 F}

* w) d" i0 ?7 M9 {( J  ?' S4 w) afunction getcreditsettings($get, $post)  [3 q# a# _" f$ J0 k, D5 p
{
8 X$ e, b+ m/ x6 `; O! z% Z- I+ v   if(!API_GETCREDITSETTINGS)7 g6 l& o* y9 I7 ?8 s8 W
   {; x* x8 O) r* H. Y6 L% `6 r; J5 p, g
    return API_RETURN_FORBIDDEN;
& e4 ~3 z  P  ]9 O+ ]7 T   }
6 E3 u5 F; m$ U2 V  & `# e: S4 u3 Z: [+ Y
   //这里支持DedeCMS积分,金币设置1 `# A5 r; x$ n) r2 W6 ~$ k  J9 \0 ?
   $credits[1] = array(strip_tags('积分'), '分');) v% V; I; C1 H6 m5 a! c$ n
   $credits[2] = array(strip_tags('金币'), '枚');
* h: Q' o$ o' H1 K3 A: P/ }& u   return $this->_serialize($credits);
- j( P! ]& C# Z( Z, x}
" Y+ Y% j* b- `5 \' C% F
function updatecreditsettings($get, $post)
9 [6 o7 C  o4 h' b; X/ c3 K{
- T+ t0 k5 j5 S) Z. O$ m   if(!API_UPDATECREDITSETTINGS). J$ t1 |7 p1 i& C2 `) `
   {+ y# G& G" e, m! R
    return API_RETURN_FORBIDDEN;
8 @- k) X0 b6 ?+ B   }
+ ^& S# F: s1 l& r2 Z! h# G   $credit = $get['credit'];
2 P% z+ G( Z& e5 C8 T0 S4 J! C) p   $outextcredits = array();; d( U0 [4 `; U. C3 E+ {2 I8 b
   if($credit && is_array($credit)) {7 ^! w. _0 w, S+ K
    foreach($credit as $appid => $credititems) {
0 o( W% p8 P0 `' o. I5 P: }2 k. i- C     foreach($credititems as $value) {% ^& K+ p" @; H% G) Z% g
      if($value['appiddesc']!=UC_APPID) continue;7 A6 [6 h: N% o, R& }, Q
      $outextcredits[$appid][] = array(
' E0 s; {8 O+ w4 w* y8 l% _       'appiddesc' => $value['appiddesc'],! A& D9 E0 }( X6 f( Z. E* f
       'creditdesc' => $value['creditdesc'],
, n9 T5 m, f4 \/ A/ s       'creditsrc' => $value['creditsrc'],& z) I% w' z7 l* ~+ L
       'title' => $value['title'],) ]. P% d( R8 o
       'unit' => $value['unit'],9 @! }6 f& ^6 k# P; ]
       'ratiosrc' => $value['ratiosrc'],
( I& e1 D1 B0 ~       'ratiodesc' => $value['ratiodesc'],( K' Y6 D- A; V6 {4 j6 h
       'ratio' => $value['ratio']
: V) B: ^, Z  |  H/ F5 R* X      );' F- w0 A  u& N3 H  z7 c
     }; Y; Z" T  L9 X( Z
    }
! O1 p7 t2 w  u   }# a, m, J; o4 A* ]9 Y$ z  F% t
   $_CACHE = "<?php !defined('UC_API') && exit("403  Forbidden!");n".'$_CACHE['credit'] =  unserialize("'.addslashes(serialize($outextcredits)).'");'."rn".'?>';0 J* M8 g5 C- N5 g7 g, U) _) D
   $fp = @fopen(DEDEDATA.'/credits.inc.php', 'w');* w, }% \6 @9 g/ j( [
   @fwrite($fp, $_CACHE);
, g: P( M8 }+ ]) |   @fclose($fp);
! ]4 p" `; j; N' m5 `# [/ u6 R- C, Z   return API_RETURN_SUCCEED;# Y% S* T$ y2 q
}
9 m" z2 X" O" |9 u$ F}

0 q! a8 k% z2 K: p/ n" D# F8 [3 G8 U! z
function _authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
) c3 g( Q. v- X# b: b5 C$ckey_length = 4;

3 d- o$ r+ x7 B6 m+ a/ Q$key = md5($key ? $key : UC_KEY);
/ Y* f, r# X( e* N# L$keya = md5(substr($key, 0, 16));
" I* g. q; p+ H3 l! U$ X$keyb = md5(substr($key, 16, 16));
8 P" W2 H- h3 g2 w, i% |$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0,  $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';

  t3 [; p! F6 I4 H8 ?" n$cryptkey = $keya.md5($keya.$keyc);
% [; {0 H# z! K6 o2 I1 a$key_length = strlen($cryptkey);

4 b0 u1 T1 R; q! L( S$string = $operation == 'DECODE' ?  base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ?  $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
+ S& t6 u6 {7 C+ F! R5 Z( G$string_length = strlen($string);
$ C3 f' T1 ]9 w9 e- p, p! Y- @
$result = '';# a8 Y& ^$ W* h. W
$box = range(0, 255);

, T& }1 z: P; J7 b3 M+ i8 y% A$rndkey = array();7 b( \  f+ J3 P& T  S  z% p- _( [
for($i = 0; $i <= 255; $i++) {
' P; r" N8 \4 A  z% _+ B+ S   $rndkey[$i] = ord($cryptkey[$i % $key_length]);+ C9 f. }+ g4 a, f6 W
}
: @5 R2 J1 e$ p; r) v
for($j = $i = 0; $i < 256; $i++) {
  j) C- A' @6 L3 P0 g   $j = ($j + $box[$i] + $rndkey[$i]) % 256;/ T4 ]) Y/ i0 ?- S
   $tmp = $box[$i];" u$ O: T7 }+ Y5 q
   $box[$i] = $box[$j];3 U( D# {/ O; h$ P% h
   $box[$j] = $tmp;8 a% u5 I' R& f% V- V8 l& d  G0 i
}

- P1 `8 [. _& K1 J, P; Ffor($a = $j = $i = 0; $i < $string_length; $i++) {
9 w& A3 d' [$ y- _   $a = ($a + 1) % 256;0 \6 w. X0 Y+ Y  A
   $j = ($j + $box[$a]) % 256;. ]3 a/ T, b" x  i+ Z
   $tmp = $box[$a];
  {# U: \5 x. S. D   $box[$a] = $box[$j];4 P% ~7 M) ~2 O; k. e) S$ O
   $box[$j] = $tmp;
# C3 a0 L5 B2 y$ O( R5 w/ q) ^   $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));' c0 D% `0 F3 C) z- a' k
}
7 W8 t/ d- f/ `0 _2 q
if($operation == 'DECODE') {4 C  M2 u0 l* R5 v# P
   if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time()  > 0) && substr($result, 10, 16) == substr(md5(substr($result,  26).$keyb), 0, 16)) {
5 v5 ~0 O  P, Z* u) \4 j& J( U# p    return substr($result, 26);
; i7 z/ S+ f' M& P1 m6 t   } else {8 B$ M  h' N2 e6 J
     return '';
8 C, f( f# M2 K! K8 t' H    }( j1 C% d% n2 _
} else {; k! D' m0 H) X3 x2 e8 p
   return $keyc.str_replace('=', '', base64_encode($result));
+ N4 {, _- |1 U7 {" S}
: K, ], L$ I' Y
}
* L7 h5 e. E' \! ^/ a/ ^' H& ^% Jfunction _stripslashes($string) {7 Y/ y; }  n  K
if(is_array($string)) {
4 ^. _6 V4 k7 A- g   foreach($string as $key => $val) {; F8 K  L  m' R, Z8 F
    $string[$key] = _stripslashes($val);/ }, e# h9 |7 ^) N( e
   }
  ^8 h  U( N, X5 u7 N- r& `# G- Z} else {
2 c6 D5 P% \* V& W2 u   $string = stripslashes($string);
* L& Q# y) m' U# t. f8 B9 `( y}
/ G& W8 ?# x0 G2 ?return $string;0 c" B' U. t  o- A
}
  \# {9 C1 D3 h) U* u
?>' C' ?; H9 }% R# Z1 ^, j6 e) D
  ^7 x" T6 T/ |; R; g

* T; y) Z4 u7 I' ^            

0

主题

7

帖子

20

积分

1°伸手党

Rank: 2

积分
20
发表于 19-10-29 05:28:19 | 显示全部楼层         
好好 学习了 确实不错
回复

使用道具 举报

网站简介

球球发,是一家 Discuz! 商业插件、风格模板、网站源码、 Discuz!运营维护技术等于一体的交流分享网站,全站95%的资源都是免费下载,对于资源我们是每天更新,每个亲测资源最新最全---球球发(如果我们有侵犯了您权益的资源请联系我们删除