[問題]關於Discuz與phpbb可以共用聊天室嗎?
發表於 : 2005-04-25 15:40
論壇: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]赤影"
2.rfz.php
這就是關鍵,必須在Discuz登入後才能使用,phpbb登入後不能,要怎樣改?
論壇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>這就是關鍵,必須在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]."'> </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>