[問題]關於Discuz與phpbb可以共用聊天室嗎?

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
頭像
赤影
星球公民
星球公民
文章: 40
註冊時間: 2005-01-12 17:35

[問題]關於Discuz與phpbb可以共用聊天室嗎?

文章 赤影 »

論壇:http://bbs.crazykill.coms.ws
論壇2:http://bt.crazykill.coms.ws
錯誤原因:

我在Discuz中有一個即時聊天室,是在聯盟下面的
http://bt.crazykill.coms.ws
我想在phpbb中也加入一個共用聊天室,即2邊也可以發言!
http://bbs.crazykill.coms.ws
\n↑在線上列表上面\r
但如果沒有登入Discuz的話,就不能用聊天室!
聊天文件有2份\r


1.rfz_write.php
發言處理,我想顯示是在哪一邊發言,例如我在phpbb就叫 "[phpbb]赤影"

代碼: 選擇全部

<?

$timestamp1 = mktime(date("H",filemtime("rfz.txt")), date("i",filemtime("rfz.txt")), date("s",filemtime("rfz.txt")), date("m",filemtime("rfz.txt")),date("d",filemtime("rfz.txt")), date("Y",filemtime("rfz.txt"))); 
$timestamp2 = mktime(date("H"),date("i"),date("s"), date("m"), date("d"), date("Y")); 
$answer=($timestamp2-$timestamp1) / (60*60*24); 
if($answer>0.04167){//超過60分鐘未更新就清空\r
   $fp=fopen("rfz.txt","w");
   fputs($fp,"");
   fclose($fp);
 }
//讀取檔案內容行數\r
    $show=file("rfz.txt");
    $max=sizeof($show);
    if($max-50<=0){$min=0;}
    else{$min=$max-50;}
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<META HTTP-EQUIV="Refresh" CONTENT=10 src="rfz_write.php"> 
<title>即時聊天室</title>
<style type='text/css'>
<!--
table {  font-size: 13px; }
-->
</style>

</head>

<body background="./images/chatbg.gif" bgproperties="fixed"
 leftmargin="0" topmargin="0" text="#FFFFFF">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber1" width="100%">
<?
  for($t1=$max;$t1>=$min;$t1--){     
      $show_word_text=split("#@#",$show[$t1]);  //把顏色和文字分離出來
        echo "<tr><td><font color='".trim($show_word_text[0])."'>".StripSlashes(trim($show_word_text[1]))."</td></tr><tr><td width='100%' height='1'></td></tr>";
      }
?>
  </table>

</body>

</html>
2.rfz.php
這就是關鍵,必須在Discuz登入後才能使用,phpbb登入後不能,要怎樣改?

代碼: 選擇全部

<?

$color_table=array("#000000","#ffd033","#cc0033","#ff6600","#cc9933","#995599","#ff00cc","#ff3399","#0099cc","#0033cc","#669900","#006633","#cc99ff","#CC33FF","#9933FF","#800080","#666666","#3366cc");//顏色表可任意更換添加
if(!empty($bsay) && trim($bsay)!=""){       
  $word_say=str_replace(">",">",$bsay);
  $word_say=str_replace("<","<",$word_say);
  $fp=fopen("rfz.txt","a");
  $word_say=$color." #@#  (".date("m月d日H:i").")".$name.":".AddSlashes(strip_tags(trim($word_say)))."
";       
     while(!is_writeable("rfz.txt")){
             }     
     fputs($fp,$word_say);        
     fclose($fp);
    }

require './include/common.php';
if(!$discuz_user) {
	showmessage('not_loggedin');
}


?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>即時聊天</title>
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0">
<form method="POST" action="rfz.php"  name="wog_top566" >
<input type="hidden" name="name" value="<?=$discuz_user?>">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber1" width="100%">
    <tr>
      <td ><font size=2>選擇顏色:
      <select size="1" name="color">//選顏色\r
      <?
        for($t1=0;$t1<sizeof($color_table);$t1++){
            $show_select="";
            if($color_table[$t1]==$color)
            {
               $show_select=" selected ";
              }
            echo "<option $show_select value='".$color_table[$t1]."' style='background-color: ".$color_table[$t1]."'>&nbsp;</option>";
           }
      ?>      
  </select> 

發言:</font>
      <input type="text" name="bsay" size="20" value=""><input type="submit" value="送出" name="B1" >
      <iframe name="wog_vvt5" src="rfz_write.php" width="99%" height="87"  border="0" frameborder="0" ></iframe>
      </td>
    </tr>
  </table>
</form>

<script>
wog_top566.bsay.focus();
</script>
</body>

</html>
歡迎加入[CrazyKill]
論壇網址:
http://free3.e-168.cn/crazykill/phpBB2/index.php
若想交換連結請到上面論壇網址內發表
頭像
赤影
星球公民
星球公民
文章: 40
註冊時間: 2005-01-12 17:35

文章 赤影 »

論壇: http://bbs.crazykill.coms.ws
論壇2: http://bt.crazykill.coms.ws
錯誤問題:
現在,在phpbb中的即時聊天,不能登入,請問是否有什麼問題,對話是存在一個文未檔內,我已經把他改為777,但卻不能...
請問是不是我代碼問題?
登入問題已經解決,但不知對不對!我在phpbb中上傳了第一貼的2個php檔並修改了如下

PHPBB中的

rfz.php

代碼: 選擇全部

<?


define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_PRIVMSGS);
init_userprefs($userdata);
//
// End session management
//

$color_table=array("#000000","#ffd033","#cc0033","#ff6600","#cc9933","#995599","#ff00cc","#ff3399","#0099cc","#0033cc","#669900","#006633","#cc99ff","#CC33FF","#9933FF","#800080","#666666","#3366cc");//顏色表可任意更換添加
if(!empty($bsay) && trim($bsay)!=""){       
  $word_say=str_replace(">",">",$bsay);
  $word_say=str_replace("<","<",$word_say);
  $fp=fopen("http://free4.e-168.cn/phpbb-test/bbs/Discuz/rfz.txt","a");
  $word_say=$color." #@#  (".date("m月d日H:i").")".$name.":".AddSlashes(strip_tags(trim($word_say)))."
";       
     while(!is_writeable("http://free4.e-168.cn/phpbb-test/bbs/Discuz/rfz.txt")){
             }     
     fputs($fp,$word_say);        
     fclose($fp);
    }

if (!$userdata['session_logged_in'] )
{
	print("請先登入論壇");
}
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>即時聊天</title>
</head>

<body bgcolor="#83a566" text="#000000" link="#000000" vlink="#000000" leftmargin="0" topmargin="0">
<form method="POST" action="rfz.php"  name="wog_top566" >
<input type="hidden" name="name" value="<b>[在CrazyKill]</b><?=$userdata['user_id']?>">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber1" width="100%">
    <tr>
      <td ><font size=2>選擇顏色:
      <select size="1" name="color">//選顏色\r
      <?
        for($t1=0;$t1<sizeof($color_table);$t1++){
            $show_select="";
            if($color_table[$t1]==$color)
            {
               $show_select=" selected ";
              }
            echo "<option $show_select value='".$color_table[$t1]."' style='background-color: ".$color_table[$t1]."'>&nbsp;</option>";
           }
      ?>      
  </select> 

發言:</font>
      <input type="text" name="bsay" size="20" value=""><input type="submit" value="送出" name="B1" > <font color=red size=3>(由於聊天記錄放在另外空間,可能會較慢!請耐心等候)</FONT>
      <iframe name="wog_vvt5" src="rfz_write.php" width="99%" height="87"  border="0" frameborder="0" ></iframe>
      </td>
    </tr>
  </table>
</form>

<script>
wog_top566.bsay.focus();
</script>
</body>

</html>

rfz_write.php

代碼: 選擇全部

<?

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);


//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_PRIVMSGS);
init_userprefs($userdata);
//
// End session management
//

$timestamp1 = mktime(date("H",filemtime("http://free4.e-168.cn/phpbb-test/bbs/Discuz/rfz.txt")), date("i",filemtime("http://free4.e-168.cn/phpbb-test/bbs/Discuz/rfz.txt")), date("s",filemtime("http://free4.e-168.cn/phpbb-test/bbs/Discuz/rfz.txt")), date("m",filemtime("http://free4.e-168.cn/phpbb-test/bbs/Discuz/rfz.txt")),date("d",filemtime("http://free4.e-168.cn/phpbb-test/bbs/Discuz/rfz.txt")), date("Y",filemtime("http://free4.e-168.cn/phpbb-test/bbs/Discuz/rfz.txt"))); 
$timestamp2 = mktime(date("H"),date("i"),date("s"), date("m"), date("d"), date("Y")); 
$answer=($timestamp2-$timestamp1) / (60*60*24); 
if($answer>0.04167){//超過60分鐘未更新就清空\r
   $fp=fopen("http://free4.e-168.cn/phpbb-test/bbs/Discuz/rfz.txt","w");
   fputs($fp,"");
   fclose($fp);
 }
//讀取檔案內容行數\r
    $show=file("http://free4.e-168.cn/phpbb-test/bbs/Discuz/rfz.txt");
    $max=sizeof($show);
    if($max-50<=0){$min=0;}
    else{$min=$max-50;}
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<META HTTP-EQUIV="Refresh" CONTENT=10 src="rfz_write.php"> 
<title>即時聊天室</title>
<style type='text/css'>
<!--
table {  font-size: 13px; }
-->
</style>

</head>

<body bgcolor="#83a566" text="#000000" link="#000000" vlink="#000000" leftmargin="0" topmargin="0" background="http://free4.e-168.cn/phpbb-test/bbs/Discuz/images/chatbg.gif" bgproperties="fixed"
>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber1" width="100%">
<?
  for($t1=$max;$t1>=$min;$t1--){     
      $show_word_text=split("#@#",$show[$t1]);  //把顏色和文字分離出來
        echo "<tr><td><span style='filter: glow(color=".trim($show_word_text[0])." ,strength=3); height:10px; color:white; padding:1px; font-size:11px'><span class='bold'>".StripSlashes(trim($show_word_text[1]))."</span></span></span></td></tr><tr><td width='100%' height='1'></td></tr>";
      }
?>


  </table>
\r
</body>

</html>

Discuz中的

rfz.php

代碼: 選擇全部

<?

$color_table=array("#000000","#ffd033","#cc0033","#ff6600","#cc9933","#995599","#ff00cc","#ff3399","#0099cc","#0033cc","#669900","#006633","#cc99ff","#CC33FF","#9933FF","#800080","#666666","#3366cc");//顏色表可任意更換添加
if(!empty($bsay) && trim($bsay)!=""){       
  $word_say=str_replace(">",">",$bsay);
  $word_say=str_replace("<","<",$word_say);
  $fp=fopen("rfz.txt","a");
  $word_say=$color." #@#  (".date("m月d日H:i").")".$name.":".AddSlashes(strip_tags(trim($word_say)))."
";       
     while(!is_writeable("rfz.txt")){
             }     
     fputs($fp,$word_say);        
     fclose($fp);
    }

require './include/common.php';
if(!$discuz_user) {
	showmessage('not_loggedin');
}
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>即時聊天</title>
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0">
<form method="POST" action="rfz.php"  name="wog_top566" >
<input type="hidden" name="name" value="<b>[在CrazyBT]</b><?=$discuz_user?>">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber1" width="100%">
    <tr>
      <td ><font size=2>選擇顏色:
      <select size="1" name="color">//選顏色\r
      <?
        for($t1=0;$t1<sizeof($color_table);$t1++){
            $show_select="";
            if($color_table[$t1]==$color)
            {
               $show_select=" selected ";
              }
            echo "<option $show_select value='".$color_table[$t1]."' style='background-color: ".$color_table[$t1]."'>&nbsp;</option>";
           }
      ?>      
  </select> 

發言:</font>
      <input type="text" name="bsay" size="20" value=""><input type="submit" value="送出" name="B1" >
      <iframe name="wog_vvt5" src="rfz_write.php" width="99%" height="87"  border="0" frameborder="0" ></iframe>
      </td>
    </tr>
  </table>
</form>

<script>
wog_top566.bsay.focus();
</script>
</body>

</html>
rfz_write.php

代碼: 選擇全部

<?

$timestamp1 = mktime(date("H",filemtime("rfz.txt")), date("i",filemtime("rfz.txt")), date("s",filemtime("rfz.txt")), date("m",filemtime("rfz.txt")),date("d",filemtime("rfz.txt")), date("Y",filemtime("rfz.txt"))); 
$timestamp2 = mktime(date("H"),date("i"),date("s"), date("m"), date("d"), date("Y")); 
$answer=($timestamp2-$timestamp1) / (60*60*24); 
if($answer>0.04167){//超過60分鐘未更新就清空\r
   $fp=fopen("rfz.txt","w");
   fputs($fp,"");
   fclose($fp);
 }
//讀取檔案內容行數\r
    $show=file("rfz.txt");
    $max=sizeof($show);
    if($max-50<=0){$min=0;}
    else{$min=$max-50;}
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<META HTTP-EQUIV="Refresh" CONTENT=10 src="rfz_write.php"> 
<title>即時聊天室</title>
<style type='text/css'>
<!--
table {  font-size: 13px; }
-->
</style>

</head>

<body background="./images/chatbg.gif" bgproperties="fixed"
 leftmargin="0" topmargin="0" text="#FFFFFF">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber1" width="100%">
<?
  for($t1=$max;$t1>=$min;$t1--){     
      $show_word_text=split("#@#",$show[$t1]);  //把顏色和文字分離出來
        echo "<tr><td><span style='filter: glow(color=".trim($show_word_text[0])." ,strength=3); height:10px; color:white; padding:1px; font-size:11px'><span class='bold'>".StripSlashes(trim($show_word_text[1]))."</span></span></span></td></tr><tr><td width='100%' height='1'></td></tr>";
      }
?>


  </table>

</body>

</html>
歡迎加入[CrazyKill]
論壇網址:
http://free3.e-168.cn/crazykill/phpBB2/index.php
若想交換連結請到上面論壇網址內發表
主題已鎖定

回到「外掛問題討論」