DZ提供了一个API 但感觉用起来不方便。。正好自己也要研究DZ的结构
查找它需要用的函数 COPY过来 写了一段与DZ实现登陆的代码
<?
require './inc/config.php';
require './inc/func.inc.php';
$action=SafeRequest($_GET['action']);
//$GLOBALS['discuz_auth_key']='6cb20f469a265be0701e517a1772eca3';
//$discuz_auth_key = md5('PuJ3BGeRubtGFsr'.$_SERVER['HTTP_USER_AGENT']);
function authcode($string, $operation, $key = '') {
$key = $key ? $key : md5('PuJ3BGeRubtGFsr'.$_SERVER['HTTP_USER_AGENT']);
$coded = '';
//print_r($GLOBALS);exit;
//echo $key;exit;
$keylength = strlen($key);
$string = $operation == 'DECODE' ? base64_decode($string) : $string;
for($i = 0; $i < strlen($string); $i += $keylength) {
$coded .= substr($string, $i, $keylength) ^ $key;
}
$coded = $operation == 'ENCODE' ? str_replace('=', '', base64_encode($coded)) : $coded;
return $coded;
}
fu

这篇博客介绍了一种不使用DZ API而是直接通过解析其内部函数,实现与DZ论坛整合登录的方法。文章中给出了相关PHP代码,包括用户验证、SID生成和会话管理等关键步骤。
最低0.47元/天 解锁文章
2633

被折叠的 条评论
为什么被折叠?



