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

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

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

765

主题

779

帖子

3万

积分

董事

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

积分
33025
发表于 19-4-26 21:18:01 | 显示全部楼层 |阅读模式      紫钻仅向指定用户开放  
                dedecms整合discuz同步登录与退出并且不用激活* K( C$ q9 w: {5 Q6 p" m

+ b0 r3 T# ^2 C    弄了一天,问题总算解决了,不过有点投机取巧,下面说下dedecms整合discuz后会员注册后不用激活的实现,以前做站时,一直在想,dede和 dz整合后,会员在网站注册后到论坛能不能不再激活,看着可不舒服,现在总算解决了,闲话不说了,下面进入正题,百度也不让发附件,只有啰嗦点了,呵呵, 比较长,分3篇:' z; t7 O( i7 X2 ~1 m- S8 B7 h, W/ `
1.首先找到dede-〉api-〉uc.php文件
4 d' p  b) z4 c3 s打开uc.php,将内容替换为:3 O* j" |$ c% S& C6 k
<?php$ K) b$ p0 F( g, c9 x
/**************************二次开发说明**************************************

' Z6 G1 p$ B6 |- @) x此模块应用于DEDECMS5.6版本,请替换API文件夹的UC.PHP,替换后,通过DEDE注册的用户,3 y, E! m7 o. q3 r5 ]
访问论坛系统可以免激活,实现同时登陆同时退出。
0 d4 U$ r' A- @- L& }' v6 c2 r* ]" J! C*****************************************版权:
http://www.zzjie.com**************/$ R8 {* a* e4 Z0 z! z
include_once (dirname(__FILE__)."/../include/common.inc.php");( ~7 m: c% C0 F4 E4 A
define('IN_DISCUZ', FALSE);

& y, q2 ?3 N6 G' a6 Xdefine('UC_CLIENT_VERSION', '1.5.0'); //note UCenter 版本标识
2 ~( K. l7 }% t. Idefine('UC_CLIENT_RELEASE', '20081031');

! {3 N1 O+ z: l. p1 G$ A& L0 }define('API_DELETEUSER', 1);   //note 用户删除 API 接口开关+ z, K& C% p* b  b
define('API_RENAMEUSER', 1);   //note 用户改名 API 接口开关- i/ m. O5 l/ n
define('API_GETTAG', 1);   //note 获取标签 API 接口开关8 L+ }* V& L6 A) z) X
define('API_SYNLOGIN', 1);   //note 同步登录 API 接口开关8 `3 O6 ]/ G& q/ K9 A% O& R
define('API_SYNLOGOUT', 1);   //note 同步登出 API 接口开关
" Q  D# `6 A* Vdefine('API_UPDATEPW', 1);   //note 更改用户密码 开关: z" X6 Y6 {" L+ ?* M
define('API_UPDATEBADWORDS', 1); //note 更新关键字列表 开关* B# M5 p, d& s( k# A
define('API_UPDATEHOSTS', 1);   //note 更新域名解析缓存 开关
; U: C+ S! ]8 s+ S) [define('API_UPDATEAPPS', 1);   //note 更新应用列表 开关
/ ]% j" `* R2 R( Vdefine('API_UPDATECLIENT', 1);   //note 更新客户端缓存 开关  E: K2 ]  C) E
define('API_UPDATECREDIT', 1);   //note 更新用户积分 开关
3 `, V) ]* Y& C) D! M1 f/ vdefine('API_GETCREDITSETTINGS', 1); //note 向 UCenter 提供积分设置 开关4 y% D4 T0 A! f$ u7 r1 q  {- G
define('API_GETCREDIT', 1);   //note 获取用户的某项积分 开关' n5 l3 ~2 H4 z4 H3 @
define('API_UPDATECREDITSETTINGS', 1); //note 更新应用积分设置 开关

5 n/ C9 }' K) Z) F* O3 Z2 V: Ddefine('API_RETURN_SUCCEED', '1');
1 y( T3 L3 g- ~+ Fdefine('API_RETURN_FAILED', '-1');, h" b7 I- ]8 c) i+ n9 U1 c- F! K5 n' h
define('API_RETURN_FORBIDDEN', '-2');

: p) \8 V+ V+ O, J" kdefine('UC_CLIENT_ROOT', DEDEROOT.'/uc_client');
4 T; m$ v, C0 i, s$ N! B2 ]3 i//note 普通的 http 通知方式; E: H5 F% J& F3 n5 _1 A
if(!defined('IN_UC'))( }# x  A3 ^- |% I7 B7 q0 f
{
/ ^, ?; M" _7 o
error_reporting(0);
5 s* ]# ?6 g& l" [set_magic_quotes_runtime(0);+ `0 n8 W' v  v/ b! o
defined('MAGIC_QUOTES_GPC') || define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());

0 C$ F- @2 s4 N, P  T: |$_DCACHE = $get = $post = array();
3 v- X7 m. I9 P5 p) r/ z$code = @$_GET['code'];; U" y' e; |6 s/ g1 `( f) V
parse_str(_authcode($code, 'DECODE', UC_KEY), $get);
1 X" E6 e6 Q- M8 B, L/ s( _. c" y  U8 o  t3 W
if(MAGIC_QUOTES_GPC)+ }; F# S; N% a# f
{% W# s0 S" l+ f1 T
   $get = _stripslashes($get);! I  s/ _1 y3 a- {5 x# V& \
}
% R  Z6 k+ I2 Y: F
$timestamp = time();
# q8 w1 A4 m- c  p9 K: w! o) Cif($timestamp - $get['time'] > 3600) {0 J* M7 p0 E% d0 m/ W5 V6 p
   exit('Authracation has expiried');
2 Z' a/ Z% q) j3 h3 n}4 I+ Z7 Y* a) @3 S
if(empty($get)) {
6 h. p4 y% m- o; p/ I; }   exit('Invalid Request');* f: w# W# x, q/ i0 o
}9 i. p! w2 w3 p  \1 D) B$ s( x
$action = $get['action'];
: S0 \) |8 @6 R2 z8 t/ J
require_once UC_CLIENT_ROOT.'/lib/xml.class.php';
% @, b/ Z; R3 B6 K$post = xml_unserialize(file_get_contents('php://input'));
- G' j* p9 I6 }0 _% H  d' q# U( c
if(in_array($get['action'], array('test',  'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout',  'updatepw', 'updatebadwords', 'updatehosts', 'updateapps',  'updateclient', 'updatecredit', 'getcreditsettings',  'updatecreditsettings')))
) E  G; f' S7 c4 V) `! \9 k0 p2 w{
! I1 S; ?+ O" L7 K* H. W   $uc_note = new uc_note();
( M: e  |5 k) C. T% y# i; W) `$ L   exit($uc_note->$get['action']($get, $post));% d; K1 U- r" n" \
}else{, C! l7 K5 w2 g& n. i" R$ B8 U1 C3 D3 ]
   exit(API_RETURN_FAILED);
* k) R* g! }  C) [8 p7 W' d% D}
3 B& L' D0 c. f3 ^
//note include 通知方式
% @9 g: W( D! H} else {

! j8 A2 D% _  }, ^. aexit('Invalid Request');
" U. V6 t( d6 Z}

& {* ]+ S  E6 @0 o3 Y1 {0 x% {class uc_note, q( W1 v5 q+ M5 ^" r. o+ W, W$ f& W1 N, G
{
% ?, s2 A) Q, G& R
var $dbconfig = '';, n0 T7 ~3 Y0 V7 G8 Y
var $db = '';
6 Q5 J% J) S6 T  e/ g5 Jvar $appdir = '';9 D. D" p$ [" V7 i/ H1 W
var $tablepre = 'dede_';3 W, H# I3 D( C

! _! X! h  A$ r7 X7 i# sfunction _serialize($arr, $htmlon = 0)  T+ C! Q$ x7 e0 ~
{
( O5 O- q, N; I6 b   if(!function_exists('xml_serialize'))
, }1 ^/ Z7 h/ m; `8 S* M; A   {5 |% l- C0 U) g  z4 T
    include_once UC_CLIENT_ROOT.'/lib/xml.class.php';
* A  h3 }- i! c3 f. w   }
* v- J" @1 P1 a) R! d   return xml_serialize($arr, $htmlon);& _0 x$ ^9 y. c+ [- a# e8 |2 t
}
- p5 H8 K1 S$ k$ b0 d9 X8 w
function uc_note()6 v0 `# O' A, R
{/ k. e- t- \+ e& u1 c
   $this->appdir = DEDEROOT;
' J5 P" M) z% `& l   $this->dbconfig = DEDEINC.'/common.inc.php';/ k8 J3 L* P5 o! k
   $this->db = $GLOBALS['dsql'];
% b! Z% ?6 @5 u) x# |: Y   $this->tablepre = $GLOBALS['cfg_dbprefix'];
, q6 p! G) F4 [, H  T" J! q}. |( z; F" J- ?
# G" Z5 u8 p# q8 s- _7 ]& E
function get_uids($uids)2 R) o7 i) h. ^# Q5 [" T
{4 M% y2 ~& L, ~4 @, G
   include UC_CLIENT_ROOT.'/client.php';0 l% y+ [% v2 ~  P- s5 n
  % a; z. u6 i9 Q3 p1 H, t
   $members = explode(",", $uids);
$ k/ I# Z% y  m7 z. R2 K7 W   empty($members) && exit(API_RETURN_FORBIDDEN);; Q4 P6 K7 x/ e; L
  : N7 w# R' C# z  G9 }
   /*$members_username = array();
4 H1 H0 U: o8 v, j+ P; T  / |( R+ ]! N% G$ B3 r
   foreach($members as $id)/ v9 [! a+ W5 X/ _1 a- }
   {& W! W, v$ l1 D8 E
    $row = uc_get_user($id,1);+ f6 _) X9 Y. \: P7 _" G8 @" E
    $members_username[] = $row[1];  : Z7 _" ?7 w4 }2 p% Q2 r
   }6 U5 z6 w2 M- k# x* K1 ?
  
* a/ O1 y, B: m6 e9 i9 ?& ]   $comma_temps = implode(",", $members_username);, f. e; b6 o; Q, @" _* [. c
  
; d9 N  _/ N+ h' F   empty($comma_temps) && exit(API_RETURN_FORBIDDEN);
4 i; Y4 H0 i: B  6 B* m9 O7 `. M% J+ q; F
   $comma_uids = array();*/
1 @. W& ]( ^* \! w% p  & q& [$ k, r7 B1 m) v
   //$row = $this->db->SetQuery("SELECT mid FROM
`dede_member` WHERE userid IN ($comma_temps)");# `! T3 q9 i' l9 e' C  }& e- W
  / P5 w4 r1 f4 C; r5 @" g: L: c/ F
   $this->db->SetQuery("SELECT mid FROM
`dede_member` WHERE mid IN ($uids)");
0 G  [6 M6 X1 z7 ~. V( }   $this->db->Execute();  
+ |& }+ s6 Y) X7 J8 M/ d+ Z0 @   while($row = $this->db->GetArray())2 p. Z  X$ g% D& c1 Z
   {
$ w& D6 \, P5 V0 e. \4 A+ ]0 h    $comma_uids[] = $row['mid'];
% `3 _9 x/ m8 _1 {% G. Z   }
$ K7 c( H" G8 M8 Z" |, c5 [5 r  
8 S/ }. ?9 h" p, s% j% ~" L! ^6 u8 c   empty($comma_uids) && exit(API_RETURN_FORBIDDEN);
4 H+ e  I% }4 ^! {; S  
7 S: T$ S: o& ?# F   return implode(",", $comma_uids);
% X; @- E+ H! Q2 S}
" G) u7 f* P; I& Q9 H1 x9 h
function test($get, $post)  M' W/ |. B( n2 c' i7 [5 k5 j
{% @3 `/ L: N1 S; J& d- T
   return API_RETURN_SUCCEED;
7 W9 N2 n+ E. G! _& h/ }+ w, a}

/ d  ^& ]/ q3 U. @3 ~# z# K5 }function deleteuser($get, $post)9 Z5 a& K: N  h7 {) S2 ?' A
{9 ]6 i6 Y9 M+ [
   $uids = $this->get_uids($get['ids']);
: S: a$ P: p. e9 A4 B: ]8 w9 x   !API_DELETEUSER && exit(API_RETURN_FORBIDDEN);
6 P1 ~7 t. ]3 D
   //note 用户删除 API 接口
# N" |, s2 T, C. B   $rs = $this->db->ExecuteNoneQuery2("DELETE FROM
`dede_member` WHERE mid IN ($uids) AND matt<>10 limit 1");
! p- t( D1 C. T0 b2 ^   if($rs > 0)2 a! m9 }$ e$ ~7 t6 r/ f& @4 q
   {
  ^% o( K  J1 s8 x! c7 c5 K3 ?    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_tj` WHERE mid IN ($uids) limit 1");
2 ~" f( X" m" [& o( D  i    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_space` WHERE mid IN ($uids) limit 1");
3 J( ^6 Q# j( i( v) ~- a    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_company` WHERE mid IN ($uids) limit 1");1 y) T9 F: l9 e3 @/ j# e8 J# ~0 ^
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_person` WHERE mid IN ($uids) limit 1");
8 O, }* G; t8 S, R! D  
% ^, i' H6 d1 E+ L& m1 l    //删除用户相关数据# W% k. U3 Z/ c
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_stow` WHERE mid IN ($uids) ");' L7 \4 x* y4 G
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_flink` WHERE mid IN ($uids) ");
4 L, D/ A! r9 E9 _- N    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_guestbook` WHERE mid IN ($uids) ");: \& Y% W% P8 L/ D! Z, g
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_operation` WHERE mid IN ($uids) ");
* n% b3 ]- F1 z4 U  r    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_pms` WHERE toid IN ($uids) OR fromid IN ($uids) ");
* e! E, i) I6 h: [) U8 K4 M, n0 |    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_friends` WHERE mid IN ($uids) OR fid IN ($uids) ");
4 j; O2 Z' Y, F    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_member_vhistory` WHERE mid IN ($uids) OR vid IN ($uids) ");5 N% |+ _. n* w0 @8 D
    $this->db->ExecuteNoneQuery("DELETE FROM
`dede_feedback` WHERE mid IN ($uids) ");" v) r* C0 ~( ^2 b4 J% k3 |- a
    $this->db->ExecuteNoneQuery("UPDATE
`dede_archives` SET mid='0' WHERE mid IN ($uids)");
) T* P- k, D' G& K4 i5 A, D" `$ z; S" p   }9 o5 d7 `5 X5 q) H7 P
   else3 ~4 z* Z- U( E' `8 K" N8 |
   {) l/ r) M& f+ L, l
    exit(API_RETURN_FORBIDDEN);9 Y- r& L4 t5 ]1 S! v, a
   }
2 H- w7 V) O* t. j9 j( `
   return API_RETURN_SUCCEED;
2 E$ N7 T  m8 u/ C: k$ E( m7 M9 p4 |}
/ S& f6 Q& F. f4 {1 B; v
function renameuser($get, $post)
. I5 e$ A* C2 n/ B. E{
: R: o0 L# K& B( ~! _9 ^   $uids = $this->get_uids($get['ids']);6 u. M" s4 }, K& o9 ^; r1 C
  
3 ?" F3 @+ q( P, {; |* y  ! p) @& R) j5 y6 U% {
   $usernameold = $get['oldusername'];
5 ~" ]; |* U' D" s) @# ]   $usernamenew = $get['newusername'];! w2 @3 W! l; t5 t" J
   if(!API_RENAMEUSER)& S: u6 v: o6 r" f8 j* Z: g2 l. [# t
   {' `2 g& t7 A7 B6 c- D" J- m. V1 s
    return API_RETURN_FORBIDDEN;
6 B: J  f. n6 r" U; ^' v   }
. T; `; {! G' |
   //note 获取标签 API 接口
- T( H+ v" n! n7 x+ |   $rs = $this->db->ExecuteNoneQuery2("UPDATE
`dede_member` SET userid='$usernamenew' WHERE userid='$usernamenew' AND matt<>10 limit 1");
& g8 s$ v. r$ L/ ^8 Z" j  C% \   if($rs > 0)
, p3 T/ v$ e9 }8 v& P   {
" S9 h0 {( r1 r( V4 m! w8 }    $this->db->ExecuteNoneQuery("UPDATE
`dede_archives` SET writer='$usernamenew' WHERE writer='$usernamenew'");6 g: i( a% n1 o  ^6 G: x
    $this->db->ExecuteNoneQuery("UPDATE
`dede_member_pms`  SET floginid=REPLACE(floginid, 't$usernameold',  't$usernamenew'),tologinid=REPLACE(tologinid, 't$usernameold',  't$usernamenew')");4 c- R- a5 T# Z1 ^
   0 ]% Q" e$ r, Z9 \4 Y
   9 |5 G: I, n3 d  ~3 v
    $row = $this->db->GetOne("SHOW TABLE STATUS");
. Z! `5 f2 e9 z7 z) U    $db_tables = $row['Name']; unset($row);
. I. u2 h7 Y7 \( x1 u- U6 X9 b   7 V: f: {- P, c( L5 _
    if(in_array($this->tablepre.'guestbook',$db_tables))
, I6 `9 [6 K" R7 m% h    {& O1 ~4 I+ {1 O, p' `: P- b
     $this->db->ExecuteNoneQuery("UPDATE
`dede_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");! o4 Q. |! l; C4 M1 M. m
    }
+ y7 R) }( E3 x2 u( w   
& |+ u# [+ g/ n+ h$ ^, i5 D: @    if(in_array($this->tablepre.'story_books',$db_tables))+ ]2 W- R: Y' O9 r7 [
    {
& B3 }1 p5 ~) X/ A4 d     $this->db->ExecuteNoneQuery("UPDATE
`dede_story_books` SET author='$usernamenew' WHERE author='$usernamenew'");; Q( U1 {2 r, {6 H: P. n' z! A
    }
9 _  _& i. ]/ s8 P% b   ! e1 ^+ L) U$ r" c
    if(in_array($this->tablepre.'groups',$db_tables))2 F; u; A! U8 L, S- _2 g! C/ I9 X
    {
, u$ [+ \7 C7 z     $this->db->ExecuteNoneQuery("UPDATE
`dede_groups` SET creater='$usernamenew' WHERE creater='$usernamenew'");
6 w: j+ `3 I( Z5 C& v1 M9 G     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_threads` SET author='$usernamenew' WHERE author='$usernamenew'");
5 o9 ^6 K, p7 W/ U/ J     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_user` SET username='$usernamenew' WHERE username='$usernamenew'");
0 `. F  }, M' L0 O& S9 K     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_posts` SET author='$usernamenew' WHERE author='$usernamenew'");& D$ p( W# }4 w' Y& B! }5 T
     $this->db->ExecuteNoneQuery("UPDATE
`dede_group_guestbook` SET uname='$usernamenew' WHERE uname='$usernamenew'");
5 R/ ^" ?- X3 q6 B5 R3 y" m$ P     $this->db->ExecuteNoneQuery("UPDATE
`dede_groups` SET ismaster=REPLACE(ismaster, 't$usernameold', 't$usernamenew')");
+ r) `7 J; V( \3 j2 j3 q! J3 J0 s    }4 I3 g6 \; o' r2 l0 i1 }9 D
   " k6 Q3 t* V9 H# p1 y
    return API_RETURN_SUCCEED;1 X9 [6 @& n' I( [* F. b0 \
   }
9 N5 d$ J; h# v( B. g   else+ g9 m0 W( b# t& n( U
   {
6 e' j; l4 ^1 `" [3 y2 @    return API_RETURN_FORBIDDEN;7 S6 L& c% B, n  R
   }* E+ u0 r; O" l% ?; a- Y
}
$ J) E; r$ v7 h. U
function gettag($get, $post)
, V; ^9 N$ r4 @& M/ ^" [{% a  D. _: B! ~! [
   $name = $get['id'];
- m* F* C& O3 Y* n6 \   if(!API_GETTAG)
+ R2 F; q' X9 ^% l   {
6 f$ j% U+ s  [( M2 q+ C' E    return API_RETURN_FORBIDDEN;
2 N! u7 T1 a, Z, I! f   }
6 B8 x4 x1 v' V# ^5 K7 Z; U
   //note 获取标签 API 接口
. N; I# G4 a2 X8 W" b   $name = trim($name);
4 S. [' V/ l2 B# u7 m4 P   if(empty($name) || !preg_match('/^([x7f-xff_-]|w|s)+$/', $name) || strlen($name) > 20)
; @* X* U- `5 B6 @, P: y  M   {
* n( a- Y% z5 V; P    return API_RETURN_FAILED;
- @; v8 j2 W/ F- Q/ S   }
$ n* o7 q% W: D0 P
   $row = $this->db->GetOne("SELECT `total`,`id` FROM `dede_tagindex` WHERE `tag`='$name'");+ r3 I9 N# t  }8 Y
   if(!is_array($row))
+ r( v9 ]3 k, v   {# S! k% X% d! X/ U  ?
    return API_RETURN_FAILED;4 z9 \9 H1 n) b7 V% H1 q* X
   }
4 d# K0 ]) O3 }/ j) D. l) z! Z" x0 q  ) L, u3 J, F& m* z& i, [3 n+ K* O7 l, A
   $tpp = $row['total'] > 10 ? 10 : $row['total'];  2 d! c% [9 A' X  Y1 y. _
  ) t" `; v; S' E, ^- s! S) Q+ z
   $ids = array();5 G4 S# [* x# ~- m
  
/ l* @; I! W' \3 ?, r5 c) t   $this->db->SetQuery("SELECT aid FROM
`dede_taglist` WHERE `tid`='$row[id]' AND arcrank>-1");& q0 Q0 x9 X2 s  Z/ O2 Y' X! e
   $this->db->Execute();
1 ~! O( A0 _5 y8 E  `   while($row = $this->db->GetArray())
6 T" _* N( K: B4 E* k) I" r   {
# ]* @3 a7 g, B* |8 _* Z    $ids[] = $row['aid'];   - u( ~. }' Z, n) O
   }6 ^* o" H5 }, \& g* [9 t/ o
  
9 Z; [# U+ F$ r% R   if(empty($ids))
) m: F0 ?7 B" W6 ^$ B8 j  }   {, v, H7 ]! ]/ `$ z7 m
    return API_RETURN_FAILED;% b. w% G; u" U  r4 W; x  L
   }
9 l, F, g+ `, i7 v9 F  
; K3 N6 x5 P/ }   $aids = implode(",", $ids);6 ~: W% s8 j& M* B
  
+ J+ |& M2 ^9 I, Q   include_once DEDEINC.'/channelunit.func.php';
, N* J; M9 n3 ^3 r" h  
+ T! K$ e) L1 L   $archives_list = array();  7 O; F1 o, n) A, W
   $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  4 a) V! t8 i$ E' G& _
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");
8 U$ V& J1 V9 c$ B2 G" b   $this->db->Execute();5 I! g( R3 k: u4 q
   while($row = $this->db->GetArray())2 z" v" [9 V( B. T$ W+ T: l
   {( b3 x! R+ m* Y! U
    $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']);

, ^1 b4 O) [; w& k  G7 _4 |5 {' v    $row['url'] = !ereg('http:',$row['url']) ? $GLOBALS['cfg_basehost'].$row['url'] : $row['url'];
) d% H7 l) v8 ]& c   
% t/ M9 k# n8 x) D  _( [0 Y    if(!empty($row['url']))
: d8 x1 C# I! h! R0 m, b6 I9 H    {. U2 S: p1 [( f( g6 T0 N! A/ I
     $archives_list[] = array('title' => $row['title'],'writer' =>  $row['writer'],'pubdate' => $row['pubdate'],'url' =>  $row['url']);& q/ `  h* i7 q3 B) _
    }
% V$ q3 Y& ]; f( H# v: W( c' D. T   }
, x  f( @9 y4 k% i: L
   $return = array($name, $archives_list);* h3 ~+ q; c4 [: O8 }  n, m+ U1 d
   return $this->_serialize($return, 1);$ b5 w! p, e1 [# l/ ]% h9 J* \/ X
}
2 ]1 f; q( H8 b& S% r
function synlogin($get, $post)
) f5 A0 G  i2 {' T& Z0 j{+ r4 V  w6 L. R0 u( k) q
   $uid = $get['uid'];
9 T* }! y1 f' x+ \: |; b   $username = $get['username'];  j  ^" o7 \2 s& c2 M
   if(!API_SYNLOGIN)
  U2 J8 n* h/ @5 O2 E  E   {3 W% G/ n* I$ W% M- W
    return API_RETURN_FORBIDDEN;- b, K* Q4 C/ w7 v1 @: f2 K0 i
   }

: u' y$ J- E$ Z% F" S   //note 同步登录 API 接口# K5 s% J" X( r
   header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
  E& Z1 Q! M* d2 n2 F* |   $result = $this->db->GetOne("SELECT mid,pwd FROM
`dede_member` WHERE `userid` like '$username' AND matt<>10");: K7 R1 X3 f& w7 d
   if(is_array($result))8 Z# u% Q5 y6 Y
   {5 G# |0 C2 u8 \; K
    include_once DEDEINC.'/memberlogin.class.php';8 E  ~. b+ v% O3 D; ]/ p
    $cfg_ml = new MemberLogin(86400);
& E) H: x4 M( u6 w- b1 k    $cfg_ml->PutLoginInfo($result['mid']);
0 z5 }- k% C" k6 H" K1 b5 R: _   }
3 R6 N' e9 b; P  N+ g$ j5 O, s7 R   else
2 A1 _" A/ J+ i$ S5 X( Z5 D9 M   {   
" p0 C- q; ~. B4 V: U0 r    //如果没有激活,则自动添加该用户到数据库,并设置已激活状态的cookie- _* V. J$ F, o& |- {: D
    //会员的默认金币
% Y* L2 y9 y/ h7 I* f+ u6 d8 i/ J    $dfscores = 0;" I3 ~: X7 U" e  z* e) B  o! t$ j
    $dfmoney = 0;* S8 T: U* C1 f9 M8 {+ N2 _, r
    $dfrank = $this->db->GetOne("Select money,scores From
`dede_arcrank` where rank='10' ");- ]" q1 Q: v, s" M$ I$ X
    if(is_array($dfrank))
" r( s( ?4 ^3 L' X# w    {
, H/ j: ~- M+ t1 |$ s5 a     $dfmoney = $dfrank['money'];
1 a6 ]7 S& \$ A+ Q# Q1 E     $dfscores = $dfrank['scores'];
: H3 D- H1 q. H. i* q7 I; ~1 k; q    }
2 w) |! m) f$ k    $jointime = time();8 Z6 p: E- v& G
    $logintime = time();
( f' p" N& }( K$ J4 r" a, a& l    $joinip = $get['regip'];
5 }8 }* R7 E" f+ D. S0 U. F9 S$ P    $loginip = $get['regip'];& P/ R' [+ R, B9 Y4 A. D4 A
    $pwd = $get['password'];) r3 @: r, ?, m/ a, w$ j, D
   
6 a1 O$ _9 H3 b, H    $spaceSta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0);5 s9 X8 `8 @' F2 B  p, D% w6 j
    $mtype='个人';
$ s" n  ~! H8 L  v# s/ M( N" I    $email=$get['email'];8 r% f! |! @4 o) O. T
   & t' ^$ q" U6 ?3 ~0 S
    $inQuery = "INSERT INTO
`dede_member` (`mtype` ,`userid` ,`pwd` ,`uname` ,`sex` ,`rank` ,`money` ,`email` ,`scores` ,, }8 @. \6 E! F5 I4 O0 s+ l
    `matt`, `spacesta` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip` )
$ b# X% I0 x# s8 `/ C% e4 d     VALUES ('$mtype','$username','$pwd','$username','保密','10','$dfmoney','$email','$dfscores',# `$ |9 Q! u9 C
     '0','$spaceSta','','','','$jointime','$joinip','$logintime','$loginip'); ";
: A6 w8 ]5 c/ B   
: B; r$ w2 ?) E    if($this->db->ExecuteNoneQuery($inQuery))* Z9 b) f2 L! W; F
    {    - u5 `* k2 G0 X4 w9 C2 b% t
     $mid = $this->db->GetLastID();0 e$ y# a* v9 v6 y" W( @
  
* U$ f) L* Q" x& a4 V( x7 y     //写入默认会员详细资料% h1 h8 F5 i# Y4 Z
     $space='person';
+ s/ q4 B  o9 ^( B1 D  
, w4 b4 g/ L! C" A& f* i; Q     //写入默认统计数据9 Z, g. ?- h# b) [- ^0 y
     $membertjquery = "INSERT INTO
`dede_member_tj` (`mid`,`article`,`album`,`archives`,`homecount`,`pagecount`,`feedback`,`friend`,`stow`)
. l  n, G& s0 ]/ x7 }                 VALUES ('$mid','0','0','0','0','0','0','0','0'); ";
; j  Y+ `8 n6 a0 j1 e     $this->db->ExecuteNoneQuery($membertjquery);
9 ~; S; G; M0 H* P/ X6 W2 B& T  ' E/ n9 N+ o8 c# G0 ~
     //写入默认空间配置数据0 \9 j) x- \! l+ Q
     $spacequery = "Insert Into
`dede_member_space`(`mid` ,`pagesize` ,`matt` ,`spacename` ,`spacelogo` ,`spacestyle`, `sign` ,`spacenews`)
* e! Z# p3 e1 S4 L) v4 w5 T               Values('$mid','10','0','$username的空间','','$space','',''); ";
1 r4 i' h9 ~8 Q8 B' q% w8 ^5 _. @! q     $this->db->ExecuteNoneQuery($spacequery);# a/ X/ A4 @" l+ [. P
  
4 [. g6 r1 @+ D  C0 j7 m6 F% m     //写入其它默认数据0 E% S  S" O; B4 j2 `
     $this->db->ExecuteNoneQuery("INSERT INTO
`dede_member_flink`(mid,title,url) VALUES('$mid','织梦内容管理系统','http://www.dedecms.com'); ");3 P) c( V: b* [0 M9 n/ I' ~
    8 l/ E4 \: u3 }. r
     include_once DEDEINC.'/membermodel.cls.php'; # j% V7 O6 J# P
   
1 \7 Z7 Y$ C" e     $membermodel = new membermodel($mtype);: F- t8 s! L. H4 v
   
" i* K8 S, Z! \2 ^     $modid=$membermodel->modid;4 Y/ C# d& s# K7 p
     
5 q& ?7 a" `3 s     $modelform = $this->db->getOne("select * from
dede_member_model where id='$modid' ");; Z+ ?, E- }/ o, ~: u1 S' m2 L* p
   
  b6 S' E; Q" G  t0 y2 {& v& j, O     $this->db->ExecuteNoneQuery("INSERT INTO `{$membermodel->table}` (`mid`) VALUES ('$mid');");4 d* V1 `& U9 l
        ) U( W2 c9 {2 A$ _2 A) R4 E' j
     //----------------------------------------------5 x1 D5 T, U7 k& y) u
     //模拟登录- q6 O" f/ Y/ g
     //---------------------------
& P5 n: [* p) r: Y     include_once DEDEINC.'/memberlogin.class.php';3 m' h* i2 M9 i9 s
     $cfg_ml = new MemberLogin(7*3600);: y2 @  e. i  v  w
     $cfg_ml->PutLoginInfo($mid);    7 j4 }" F- k5 V- s* {4 E- x* e
    / L$ v* y2 z4 c: Y* G4 a1 Q
    }+ a/ Q* I3 i# x/ X3 L) S% y
   
7 p  S/ Y, z: O8 Z, L' G   }
0 i% p5 n( i3 P* N* Q0 P' k}
$ c; T& i  g6 X& s
function synlogout($get, $post)9 Q- k6 n8 K, A, ^8 w' b
{
5 P  g0 c" S, F( }3 n& l   if(!API_SYNLOGOUT)4 K. h* l- J* Z; q* \8 Z6 h0 S
   {
' E$ Z, v! r8 [% z    return API_RETURN_FORBIDDEN;
, U7 O0 y9 m/ [0 |; Y4 i/ W8 [   }

( i4 o4 [/ y  T- ]3 c3 L( k6 _, h   //note 同步登出 API 接口
- G$ @# K. u6 R   header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');$ h0 c" `/ [6 t/ {5 M; f
   include_once DEDEINC.'/memberlogin.class.php';& Y& k3 ~  g0 A2 K  a
   $cfg_ml = new MemberLogin();
/ _5 i. F5 y6 S) E  B   $cfg_ml->ExitCookie();. S6 \! Q! I4 z& _
}
0 i" n4 g5 W3 W: i0 I* `
function updatepw($get, $post)' V2 E, n% p. U
{0 r$ t" A* T3 U5 ?
   if(!API_UPDATEPW)/ H+ `% Z' Y) W0 p9 x$ _
   {* q1 m, b$ B; `2 g5 m
    return API_RETURN_FORBIDDEN;
- {. A- r+ j/ D2 ^5 O( J8 U   }
, C5 I6 F, e1 i9 G   $username = $get['username'];
  h) g5 k$ |  J% Y5 k% k* m   $password = $get['password'];% v: J: q, k) g2 C1 s. ~  N
  $ Q! Q: A- I6 ]" v6 E) e+ q' H: g
   //note 修改密码 API 接口6 ?- ]; R& m& Y9 Q
   $newpw = md5($password);
8 g: D6 r1 S1 f* G! [7 z, b: c$ X   $this->db->ExecuteNoneQuery("UPDATE
`dede_member` SET `pwd`='$newpw' WHERE `userid`='$username'");+ E) F3 P: m( p: F
   return API_RETURN_SUCCEED;
. I' j9 L4 Z5 L  B, M7 X' m4 D}

7 b( `0 M4 x2 W% P- zfunction updatebadwords($get, $post)
, J8 a2 \$ Z% h, H/ Q6 n% {% w{( u6 y1 o. B* \+ b, c+ b
   if(!API_UPDATEBADWORDS). _) t" l# G, L
   {) j# X) d. z% e- Z, p
    return API_RETURN_FORBIDDEN;
" M% e1 ], g  `   }

4 v* q6 [/ \/ _1 H7 ?$ u   $row = $this->db->GetOne("SELECT `value` FROM `dede_sysconfig` WHERE `varname`='cfg_replacestr'");
" z  }$ W2 O8 _0 o2 ^4 R+ `, a9 R1 R  6 v( ^9 s/ A7 u
   $badwords = isset($row['value']) ? explode(",", $row['value']) : array();
9 b0 @( }& n; M3 t  6 u, W. U( k+ g% I! }( w% _
   if(is_array($post))( F# m+ [0 Q/ C! @. Y) ~7 y' n% x! F2 P
   {
$ M& X" v" }  k    foreach($post as $k => $v)
1 V9 [- K+ M3 A9 h9 z1 g    {
2 ?! N4 {) v1 P6 v# V     if(in_array($v['find'],$badwords)) continue;2 |# S( S! W0 m3 R, d
     $badwords[] = $v['find'];
2 g& H" A6 ]8 G' _7 q) P9 O; s6 H    }. t  U$ S. w  n& _1 X/ k1 j
   }
: L1 U# j0 n5 m8 ?$ o( O2 H" |# W4 X
   $badwords_comma = !empty($badwords) ? implode(",", $badwords) : '';
* k3 T& s3 S& G" j; i! v0 |; x  
  P- d+ w7 ^, x1 \3 R  o, R
   $this->db->ExecuteNoneQuery("UPDATE `dede_sysconfig` SET `value`='$badwords_comma' WHERE `varname`='cfg_replacestr'");
; m! J- e/ T" T# n1 _9 ?  + ^( }: i3 g4 [% ^4 I! ]" H
   $cachefile = DEDEDATA.'/config.cache.inc.php';
& n: _1 J# C* t6 V2 l9 o! i0 Z! V  3 P% E' k! [* `( p6 D2 [% e6 m) V
   if(!is_writeable($cachefile))
6 p# ]# T& r6 |! e2 G; Q( p0 v/ y   {( Q7 m% |9 \, a9 o8 t( }8 }: z
    return API_RETURN_FORBIDDEN;
  M4 P/ {9 ^5 m, c' j# i1 I/ D   }
1 \- ?0 ?7 s0 O& B6 N
   $fp = fopen($cachefile, 'w');5 w1 q) M0 p  e7 H5 g" q- J, N
   $this->db->SetQuery("SELECT `varname`,`type`,`value`,`groupid` From
`dede_sysconfig` order by aid asc ");- X: X5 U0 H; l
   $this->db->Execute();
1 G$ W  g  t2 Q8 I   $s = '<?php'."rn";
. V6 `& y9 ~! \: ^0 N   while($row = $this->db->GetArray())
# s" E3 h/ u" M5 ?1 J3 E/ F. Q   {- [6 a, E% A8 U1 j( |# R8 d. K0 Q+ u
    $s .= '$'.$row['varname'].' = '.($row['type']=='number' ?  $row['value'] : "'".str_replace("'",'',$row['value'])."'").";rn";
: b! x& m' U; k8 M   }* E" U* d8 Y  A2 H6 Y# h2 g
   $s .= '?>';
! A4 u; q  H. ~" e   fwrite($fp, $s);
+ _; B0 y- v1 `0 x& u   fclose($fp);
7 p2 {3 K  I6 q3 i' T# F   return API_RETURN_SUCCEED;
- [- i/ O, o3 }3 W& N8 p* Z/ m9 m3 F/ X}
# J. |  ]( a3 q9 y+ x5 \
function updatehosts($get, $post)
. z7 s* J5 B1 v{8 ]: @! r+ Y: g% ^/ a: x* w6 w
   if(!API_UPDATEHOSTS)# G5 |# Y, ~8 A7 W4 H
   {7 m! `) c- H, M1 T# `( |8 Y! B* E2 _
    return API_RETURN_FORBIDDEN;
6 V6 n& @, V3 h3 a' h- }   }% w: r; @' |& L! P6 C; @1 S
   //note 理新HOST缓存 API 接口) T& ?) W0 |$ F* E* r
   $cachefile = UC_CLIENT_ROOT.'/data/cache/hosts.php';1 C7 F! \( x+ L) r
   $fp = fopen($cachefile, 'w');7 i1 u) z  g% H2 |
   $s = "<?phprn";4 X! K5 Y9 I) r* h5 d7 W5 [9 n  A) v( d
   $s .= '$_CACHE['hosts'] = '.var_export($post, TRUE).";rn";
# n7 p* x" w! K8 Z, W' _' e   fwrite($fp, $s);/ F# F7 w2 a6 d7 }& u& K8 R
   fclose($fp);
& X8 T+ C# j+ o   return API_RETURN_SUCCEED;
2 _0 H$ h# Q, E; I; i}

8 F# |& H/ G$ u$ [1 `: n$ rfunction updateapps($get, $post)
1 ]7 w0 S2 A1 O8 e{
: d- b% X. w, C$ `   if(!API_UPDATEAPPS)
% s' S! R6 [* f   {
' `6 g/ U! N% L$ A$ b1 Y/ V    return API_RETURN_FORBIDDEN;
0 t( l) e+ J: e9 A$ J7 R, m, C   }
: ]) [0 S6 X* V* H: C   $UC_API = $post['UC_API'];

3 m7 K5 T- x" z( b   //note 写 app 缓存文件: R+ u9 c2 y; t$ X
   $cachefile = UC_CLIENT_ROOT.'/data/cache/apps.php';1 y. t3 n( J6 ~
   $fp = fopen($cachefile, 'w');
$ y( g, w" G$ M8 j4 h4 ~& H   $s = "<?phprn";, x8 `$ j; c# I3 X
   $s .= '$_CACHE['apps'] = '.var_export($post, TRUE).";rn";4 }+ x7 d: `/ j0 \% R
   fwrite($fp, $s);9 T0 u5 ^! H& G+ L9 T
   fclose($fp);

1 N1 z+ B( ~, `! \9 y   return API_RETURN_SUCCEED;
0 p# T1 H/ m$ B}
2 X- f! n/ o8 s' u( K
function updateclient($get, $post)/ M( V% Z& }. K# Y/ a9 J! n9 ?
{4 j8 T% H4 r6 I9 ]" F. E
   if(!API_UPDATECLIENT)
: ?% x" q/ _' u0 L9 p   {
% k) H! O' [0 Z! T6 g2 W1 c! Z3 ^    return API_RETURN_FORBIDDEN;3 X9 O3 e6 I* M: ]+ I) g9 K4 ?: q
   }
9 g) Q4 y0 ?4 c4 b$ l" [   $cachefile = UC_CLIENT_ROOT.'/data/cache/settings.php';, \7 q* e/ V3 W7 ^7 {
   $fp = fopen($cachefile, 'w');
. p( N3 }0 u- f$ c/ O   $s = '<?php'."rn";
  k' e6 o) `3 n* d   $s .= '$_CACHE['settings'] = '.var_export($post, TRUE).";rn";/ ~3 N1 t- G. }1 N* V$ S; ~
   fwrite($fp, $s);$ R0 k0 s+ |! B$ x! D
   fclose($fp);
. \+ ^- ]! N( u4 r2 w3 v1 F  {3 e  & f% s0 N# k5 @
   return API_RETURN_SUCCEED;
% w# d& H% ?5 U+ c}
8 h6 n9 e" t5 R4 Y  k
function updatecredit($get, $post)
# `; ^0 Q: C/ e# c{" L( K3 n4 `( Z: v2 d+ E
   if(!API_UPDATECREDIT)
- K2 E& p# D! U  T4 o; e   {( I6 l* F* x, Y- e1 x
    return API_RETURN_FORBIDDEN;
1 M) G1 r( }+ n$ T: l   }
. _4 s$ `; k" |, }7 A* p   /*5 \3 u/ G$ ~$ m: [  D' n
   note 更新积分! V1 t6 p9 x* n3 Q  {
   discuz 默认8个积分表达,而DedeCMS只有一个积分字段,scores.注意money不能做积分来用.) `1 O- O( M. b3 m- H
   extcredits1 extcredits2 extcredits3 extcredits4 extcredits5 extcredits6 extcredits7 extcredits8$ R0 B$ h2 L9 f7 H1 I
   */
5 n6 ~6 Q  |' P' j2 z7 G5 I    ' E+ o" z" F9 a2 |7 r5 e
   $credit = intval($get['credit']);2 ~' ^( D4 }0 s- y1 P6 f2 [1 d) g# x
   $fileds = $credit > 1 ? 'money' : 'scores';9 N# U7 h$ s6 q2 I. }/ J
   $amount = $get['amount'];9 r' ]3 ]8 W6 S( G. L5 S) x
   $uid = $get['uid'];% Q! ]# B5 u; L9 Z
   include UC_CLIENT_ROOT.'/client.php';
( e  V  _9 |6 e9 f; n  m   $data = uc_get_user($uid,1);
# K0 d" p9 \. E- d/ u  h1 }   $username = $data[1];; q+ V4 v. d7 j5 J1 E: S6 N; G
  % U& i8 {& f9 x0 k) e( k- J5 e
   $result = $this->db->GetOne("SELECT mid FROM
`dede_member` WHERE userid='$username'");- s" n3 o- l- W) |. W! U6 p
   if(is_array($result))  U0 H4 M0 i1 h; }$ q
   {7 H: u  p' O1 K& K& J, g/ [
    $this->db->ExecuteNoneQuery("UPDATE
`dede_member` SET `$fileds`=`$fileds`+'$amount' WHERE mid='$result[mid]'");
+ b. g- P( b. L   }
& `9 r1 `" {1 U$ d  ; v) R8 f8 |4 O# l, ]* o- m& H6 M
   return API_RETURN_SUCCEED;
% e7 N# e, G, r1 w0 N4 t7 h}
- J4 o5 h5 w# B. e5 b
function getcredit($get, $post)
/ v& F. v9 Y: m- u& h% r{, v! C% k9 o8 O8 G
   if(!API_GETCREDIT)
/ f0 ^' E8 Y" S+ t4 L   {
6 s$ T4 Z4 O5 X  b- @    return API_RETURN_FORBIDDEN;' u2 l3 |7 X% T: j
   }
2 B4 g- D+ n+ k) {( z7 t8 }  * ?& j$ L5 w& B' _( v6 W
   include UC_CLIENT_ROOT.'/client.php';% s2 B- {% ?/ r
   $data = uc_get_user($uid,1);
6 Q9 y. @, S' i5 D$ _9 U/ T   $username = $data[1];7 Q  u* H+ a3 P2 f
   $credit = intval($get['credit']);
9 Q7 R7 t2 I; z  i4 T* J   $fileds = $credit > 1 ? 'money' : 'scores';
0 A6 z, u/ }% M) R4 N/ s! t- {   $result = $this->db->GetOne("SELECT `$fileds` AS credit FROM
`dede_member` WHERE userid='$username'");( I0 a- z0 h: {% O( C3 x0 A
  
/ ?% m5 U9 J" ^. A& E& Z0 \" J, R   echo is_array($result) ? $result['credit'] : 0;  
1 @* S  A' n# N( ^( E, Q}
) f8 h; [; M* ~: \
function getcreditsettings($get, $post)
0 k* J$ M$ T$ C& E3 b( W" N{
1 I2 i& l/ W% |! `7 T   if(!API_GETCREDITSETTINGS)
9 H, |1 O; }3 m5 Y   {
  x$ h- b$ A4 }2 Q/ ^1 F    return API_RETURN_FORBIDDEN;
" G9 ?7 G& k2 T# O/ C% ~2 Y! L   }
4 z$ ?6 D1 W/ K4 E  3 L6 ]5 p+ d; u0 k; Y4 I/ B3 n
   //这里支持DedeCMS积分,金币设置% @  r! P! A( o3 ]% t% a  r
   $credits[1] = array(strip_tags('积分'), '分');
$ a( s% T7 W2 r2 {   $credits[2] = array(strip_tags('金币'), '枚');
9 x( N  |! W9 f1 ]6 ~6 u   return $this->_serialize($credits);6 u5 ~0 B) B. s: R
}
$ @) K* c1 d" I! y
function updatecreditsettings($get, $post)
- B% I: L4 _/ R! K{$ r( [; }- n" ]$ q& U9 k( L" Y
   if(!API_UPDATECREDITSETTINGS)6 c8 @% g! }  ~0 }. n# G/ \
   {# K$ i) _1 G- ~* p) i+ Y
    return API_RETURN_FORBIDDEN;4 F, Z0 X0 G' I7 H
   }
8 p9 Q; b7 o& x2 ]8 ]! D. [/ E   $credit = $get['credit'];
. F& }$ E/ P6 e% m! M' C& p   $outextcredits = array();
& u! D2 X+ G( _2 j   if($credit && is_array($credit)) {
3 v2 z* q& i( G) @3 M    foreach($credit as $appid => $credititems) {
. Y0 w* o1 \* I! Y4 M+ h7 {  b     foreach($credititems as $value) {4 ]" {/ p5 ^/ I( @; }3 F1 w
      if($value['appiddesc']!=UC_APPID) continue;& @/ M( i) ^" P: [. z
      $outextcredits[$appid][] = array(
1 x/ {. H0 P+ y! Y# C       'appiddesc' => $value['appiddesc'],/ @6 [# V) y' c
       'creditdesc' => $value['creditdesc'],7 R9 t2 z1 g7 h1 k7 |1 j- ?1 j
       'creditsrc' => $value['creditsrc'],
' K( x% U8 F3 {9 g5 ^       'title' => $value['title'],; V4 V* O) E! Z" b: A
       'unit' => $value['unit'],
- [3 v4 h  S* V; M# U  F       'ratiosrc' => $value['ratiosrc'],
# f5 H# X& a! G6 P1 R$ d       'ratiodesc' => $value['ratiodesc'],; p4 U6 G( P7 R
       'ratio' => $value['ratio']8 `% g# Y* s$ U2 a
      );
6 F1 u& L; L1 h1 O     }4 g; m- q* `8 h( n0 p
    }
- ]. \& j+ Y: d3 N% M   }5 i: ~# n0 d, p& V# h& d
   $_CACHE = "<?php !defined('UC_API') && exit("403  Forbidden!");n".'$_CACHE['credit'] =  unserialize("'.addslashes(serialize($outextcredits)).'");'."rn".'?>';# q- D$ ^- Q, I3 \3 m1 V4 J
   $fp = @fopen(DEDEDATA.'/credits.inc.php', 'w');
  n; c7 d9 {+ J, }$ V' W   @fwrite($fp, $_CACHE);0 V) @/ v+ ]( _5 }
   @fclose($fp);
6 k3 W( b& s8 s& y, i3 K- F6 g   return API_RETURN_SUCCEED;
" }4 i3 P  s. }: x( V# g/ K}
5 d, i; i9 @( Y; U}
1 {( M1 a4 d1 C& U; D

6 r1 e1 y0 q% l" A/ H, v6 X# ~& hfunction _authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
: [& _+ t5 b6 W( Q: |$ckey_length = 4;

. p' {/ i+ Q: v# q# P# z5 C$key = md5($key ? $key : UC_KEY);
. X& t6 V/ N4 t3 G$keya = md5(substr($key, 0, 16));
* ?# V" }  v/ L  a- y$keyb = md5(substr($key, 16, 16));7 m. H6 ^0 G* j
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0,  $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
5 @5 v5 t2 I( O- t$ ?5 |+ r3 ]
$cryptkey = $keya.md5($keya.$keyc);
$ M0 `( D8 U+ R/ ?$key_length = strlen($cryptkey);
; H+ S' B% R2 [( i) Q" d9 |( e
$string = $operation == 'DECODE' ?  base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ?  $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;! p5 d0 `, f) t
$string_length = strlen($string);

# O8 Z+ m0 G  \. F, ]$result = '';
9 b% N. G: B& v3 V9 e/ N, `$box = range(0, 255);

% U! T6 B* u( r, E: R: p$rndkey = array();
& g5 m' `5 V* rfor($i = 0; $i <= 255; $i++) {- C6 `" g1 X. R+ S' h& x7 c
   $rndkey[$i] = ord($cryptkey[$i % $key_length]);
9 z  X5 J- |1 d' o$ A}
1 G6 f: A+ L" X7 T2 l1 q- [
for($j = $i = 0; $i < 256; $i++) {
9 w6 U; R2 `( I! L( S4 }( B   $j = ($j + $box[$i] + $rndkey[$i]) % 256;
6 B) F# {$ [  S- h3 p9 V# V   $tmp = $box[$i];
5 {7 m: n$ K3 t' n: Z   $box[$i] = $box[$j];/ D  o/ n2 Z* B; M1 Q
   $box[$j] = $tmp;
: ^# p4 u$ b" \: a}
; L2 o. D) D$ J; l4 B
for($a = $j = $i = 0; $i < $string_length; $i++) {' S1 C6 J( }4 k% @( I( C
   $a = ($a + 1) % 256;$ Y6 i6 f9 A. {1 U
   $j = ($j + $box[$a]) % 256;! g/ L8 D: C) t% c$ b  D
   $tmp = $box[$a];
& ?- R2 a9 B. q- F: J) N   $box[$a] = $box[$j];
, F% ~/ |5 g, U  z   $box[$j] = $tmp;
* Y0 M- I" c% K& l   $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));8 k% \% l$ n: A. q, x* z' L& _1 @
}
4 Q. o3 g8 g. X0 }/ C) K! q
if($operation == 'DECODE') {. @7 _5 B- Z" ~; k8 g
   if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time()  > 0) && substr($result, 10, 16) == substr(md5(substr($result,  26).$keyb), 0, 16)) {
% V9 S2 j5 R5 M, T2 P& E, H    return substr($result, 26);  |0 E( U+ D9 |% l! U5 K/ S' G8 S
   } else {
% R  }& B3 n5 a" b     return '';- ?) y6 H' Y* z
    }2 }  T$ y/ R+ x" ~3 `+ z
} else {$ t+ L7 O2 P/ m! n; N
   return $keyc.str_replace('=', '', base64_encode($result));# m8 o0 U( L& F4 I7 N" H6 M4 c) s$ e
}

: L2 y6 S/ I" E& F5 a+ e}7 Y7 [6 w6 n* P) V% [, {
function _stripslashes($string) {
9 ~4 O. W* b* `- k+ h4 @6 B4 ?2 Qif(is_array($string)) {3 @4 l& @7 x9 O6 F) R# T4 o
   foreach($string as $key => $val) {
' X, Z3 N; ?) c* m  g2 h! m% U0 I5 A    $string[$key] = _stripslashes($val);7 C; {$ h7 a2 y
   }
" ?( p* H1 `3 R6 c$ D6 v} else {( {( q! B. v4 x% P5 S" K/ }: [
   $string = stripslashes($string);' c+ m. L/ h. |0 c" [
}7 W5 o, z$ j' W: _6 y8 t/ f
return $string;
$ \2 i  x) I5 t- P}
5 |9 Q  j. j+ `
?>& _. w& a' \" z' Y9 Z! K* B

! T4 N9 r. _, w8 z! q. ?
7 R1 d1 v3 ^1 q7 J4 z# k4 s" o; _            

0

主题

8

帖子

20

积分

1°伸手党

Rank: 2

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

使用道具 举报

网站简介

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