喜悦国际村 
» 游客:  注册 | 登录 | 搜索 | 统计 | 喜悦证交所 | 帮助

RSS 订阅当前论坛  

$5.95 Web Hosting     

上一主题 下一主题
     
标题: [问题] 求助,,兄弟们帮帮我!有关discuz  
 
yhf111
新手上路
Rank: 1



UID 90386
精华 0
积分 42
帖子 18
金钱 42 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2007-3-29
状态 离线
[广告]: Enom域名自助付费 自助注册 自助PUSH 主流域名COM等一律57.99元年
求助,,兄弟们帮帮我!有关discuz

有没有人知道如何自己做一个登陆页面与discuz的论坛能同步登陆,同步退出,
能不能提供详细代码,,我搞了三天,还搞不定的,求助各位帮帮我.

[ 本帖最后由 yhf111 于 2007-4-17 05:23 PM 编辑 ]
2007-4-17 05:22 PM#1
查看资料  发短消息  顶部
 
真爱有限
新手上路
Rank: 1



UID 78360
精华 0
积分 12
帖子 12
金钱 12 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2006-8-15
状态 离线
[广告]: 代充Paypal帐号美元
DEDECMS有这功能 可以参考
2007-4-17 05:37 PM#2
查看资料  发短消息  顶部
 
kuco
高级会员
Rank: 4
一半会员


UID 66126
精华 0
积分 954
帖子 962
金钱 907 喜悦币
威望 0
人脉 47
阅读权限 50
注册 2005-8-23
来自 上海
状态 离线
[推荐阅读] 求广东php工作
具体去看看 discuz! 的 passport 文档

<?php
    
//准备工作:修改 ***/forumdata/cache/cache_settings.php
    //里面的 'passport_status' => 'passport',
    //       'passport_expire' => 3600,
    //       'passport_key' => '123456', //<--这里的 key 与下面的 key 要一致


    //通行证访问地址
    
$apiUrl 'http://192.168.172.111/myweb/Discuz!_5.5.0_SC_UTF8/upload/api/passport.php';

    
//登录后的显示页面
    
$resultUrl 'http://www.baidu.com';

    
//用户名
    
$userName "admin";

    
//密码
    
$userPwd md5("admin");

    
//密钥
    
$key "123456";

    
//动作类型:登录
    
$action "login";

    
$member = array(
            
'time'        => time(),
            
'username'    => $userName,
            
'password'    => $userPwd,
            
'email'        => '[email]admin@admin.com[/email]');

    
//加密
    
$auth passport_encrypt(passport_encode($member), $key);
    
$verify md5($action.$auth.$resultUrl.$key);
    
$locationUrl $apiUrl.'?action=login&auth='.rawurlencode($auth).'&forward='.$resultUrl.'&verify='.rawurlencode($verify);

    
header('Location: '.$locationUrl);

    
//以下是加密解密函数
    
function passport_encrypt($txt$key) {
        
srand((double)microtime() * 1000000);
        
$encrypt_key md5(rand(032000));
        
$ctr 0;
        
$tmp '';
        for(
$i 0$i strlen($txt); $i++) {
            
$ctr $ctr == strlen($encrypt_key) ? $ctr;
            
$tmp .= $encrypt_key[$ctr].($txt[$i] ^ $encrypt_key[$ctr++]);
        }
        return 
base64_encode(passport_key($tmp$key));
    }

    function 
passport_decrypt($txt$key) {
        
$txt passport_key(base64_decode($txt), $key);
        
$tmp '';
        for (
$i 0$i strlen($txt); $i++) {
            
$tmp .= $txt[$i] ^ $txt[++$i];
        }
        return 
$tmp;
    }

    function 
passport_key($txt$encrypt_key) {
        
$encrypt_key md5($encrypt_key);
        
$ctr 0;
        
$tmp '';
        for(
$i 0$i strlen($txt); $i++) {
            
$ctr $ctr == strlen($encrypt_key) ? $ctr;
            
$tmp .= $txt[$i] ^ $encrypt_key[$ctr++];
        }
        return 
$tmp;
    }

    function 
passport_encode($array) {
        
$arrayenc = array();
        foreach(
$array as $key => $val) {
            
$arrayenc[] = $key.'='.urlencode($val);
        }
        return 
implode('&'$arrayenc);
    }


?>




阿里妈妈再掀疯狂采购风,急召天下站长,新加入站点3天内一定采购!
2007-4-17 06:57 PM#3
查看资料  Blog  发短消息  顶部
 
yhf111
新手上路
Rank: 1



UID 90386
精华 0
积分 42
帖子 18
金钱 42 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2007-3-29
状态 离线
[推荐阅读] APACHE配置问题!
这段代码如何用呀,放在那里我都不知道的,
我想要的效果是这样子的,在我的网站首页有一个登陆框,,我想一登陆session能同时和discuz的登陆整合的,
2007-4-17 07:30 PM#4
查看资料  发短消息  顶部
 
海怪
新手上路
Rank: 1


UID 73353
精华 0
积分 45
帖子 42
金钱 45 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2006-5-14
状态 离线
[推荐阅读] APACHE配置问题!
我也在研究这个那  
同问
2007-4-17 09:51 PM#5
查看资料  发短消息  顶部
 
ripen
中级会员
Rank: 3Rank: 3
一般会员


UID 66304
精华 1
积分 278
帖子 298
金钱 268 喜悦币
威望 10
人脉 0
阅读权限 30
注册 2005-8-30
状态 离线
[推荐阅读] APACHE配置问题!
其实,挺简单的!
首先要包含common.inc.php文件:也即:require_once './include/common.inc.php';

其次再判断一下$discuz_user这个变量是否存在,为空则没有用户登录;否则有客户登录状态;




孔子曰 打架用砖乎 不宜乱扔乎 往头上扔乎 出血乎 不出血接着乎
2007-4-18 05:26 PM#6
查看资料  Blog  发短消息  QQ  顶部
 
isno (小仙)
版主
Rank: 7Rank: 7Rank: 7
好想谈恋爱


UID 78818
精华 1
积分 115536
帖子 3990
金钱 113956 喜悦币
威望 10
人脉 1570
阅读权限 100
注册 2006-8-22
状态 离线
[推荐阅读] 排列函数
我以前网站首页用ajax的  因为无法实现同步登录... 所以放弃了
2007-4-18 05:40 PM#7
查看资料  Blog  发短消息  顶部
 
lyxcf
中级会员
Rank: 3Rank: 3



UID 78421
精华 0
积分 309
帖子 205
金钱 309 喜悦币
威望 0
人脉 0
阅读权限 30
注册 2006-8-16
来自 北京 角门北路
状态 离线
[推荐阅读] 谁有Seagull的中文学习资料


<?
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;
}

function 
dsetcookie($var$value$life 0$prefix 1)
{
 global 
$tablepre$cookiedomain$cookiepath$timestamp$_SERVER;
 
setcookie(($prefix $tablepre '').$var$value,
 
$life $timestamp $life 0$cookiepath,
 
$cookiedomain$_SERVER['SERVER_PORT'] == 443 0);
}

function 
random($length$numeric 0) {
 
mt_srand((double)microtime() * 1000000);
 if(
$numeric) {
  
$hash sprintf('%0'.$length.'d'mt_rand(0pow(10$length) - 1));
 } else {
  
$hash '';
  
$chars 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
  
$max strlen($chars) - 1;
  for(
$i 0$i $length$i++) {
   
$hash .= $chars[mt_rand(0$max)];
  }
 }
 return 
$hash;
}

if (
$action=='check'){
 
$user=SafeRequest($_POST['user']);
 
$pass=md5($_POST['pass']);
 
$cookietime=SafeRequest($_POST['cookietime']);

 
$sql="select * from dz_members where username='$user' and password='$pass'";
 if (
$db->num_rows($db->query($sql))>0){
  
$rs=$db->fetch_assoc($db->query($sql));
  
$uid=0;
  
$seccode rand(1000,9999);
  
$ips=explode('.',$_SERVER["REMOTE_ADDR"]);
  
$sid=random(6);
  
setcookie('dz_sid',$sid,time()+86400);
  
setcookie('dz_cookietime',2592000,time()+86400);
  
//setcookie('aa',"bbb");
  
$sql1="INSERT INTO dz_sessions (sid, ip1, ip2, ip3, ip4, uid, username, groupid, styleid, invisible, action, lastactivity, lastolupdate, seccode, fid, tid, bloguid)VALUES ('$sid', '$ips[0]', '$ips[1]', '$ips[2]', '$ips[3]', '".$rs["uid"]."', '$username', '".$rs["groupid"]."', '".$rs["styleid"]."', '0', '1', '".time()."', '".time()."', '$seccode', '0', '0', '0')";
  
$db->query($sql1);
  
$_SESSION['user']=$rs['username'];
  
$_SESSION['pass']=$rs['password'];
  
ShowMsg('登陆成功');
 }
}
print_r($_SESSION);
?>
<link href="./css/index.css" rel="stylesheet" />
<form method="POST" action="?action=check">
<table width="200" border="0" cellspacing="1" bgcolor="#CCCCCC">
 <tr>
  <td height="30" bgcolor="#f9f9f9">用户:<? GetInputText('user');?></td>
 </tr>
 <tr>
  <td height="30" bgcolor="#f9f9f9">密码:<input type="password" name="pass" class="input"></td>
 </tr>
 <tr>
  <td height="30" bgcolor="#F6F6F6"><? GetInputSubmit();?>
  <input name="cookietime" type="hidden" id="cookietime" value="86400" />
  </td>
 </tr>
</table>
</form>
2007-4-19 12:10 PM#8
查看资料  访问主页  发短消息  QQ  顶部
 
yhf111
新手上路
Rank: 1



UID 90386
精华 0
积分 42
帖子 18
金钱 42 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2007-3-29
状态 离线
[推荐阅读] 新数通科技北京有限公司招聘PHP工程师
require './inc/func.inc.php';
代码如何写的呀,能不能提供出来呀,
2007-4-19 07:28 PM#9
查看资料  发短消息  顶部
     


  可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题 | 开通个人空间  


 




Powered by Discuz! 6.1.0  © 2001-2010 Comsenz Inc.
Processed in 0.042303 second(s), 6 queries

(冀ICP备05009913号) 管理员:sadly 邮箱/MSN: sadly@phpx.com QQ:824008(长隐) 清除 Cookies - - Archiver - WAP